How to use tmp method in wpt

Best JavaScript code snippet using wpt

ABC085C.js

Source:ABC085C.js Github

copy

Full Screen

1// inputに入力データ全体が入る2function Main(input) {3 input = input.split(" ");4 var N = parseInt(input[0]);5 var Y = parseInt(input[1]);6 var A = 0;7 var B = 0;8 var C = 0;9 if(10000*N < Y || 1000*N > Y){10 console.log("-1 -1 -1");11 }12 else{13 var tmpC = Y%5000/1000;14 C = tmpC;15 Y -= 1000*tmpC;16 N -= tmpC;17 var tmp = Y/5000;18 B = tmp;19 if(tmp == N){20 console.log(A+" "+B+" "+C);21 }22 else if(tmp > N){23 A = tmp - N;24 B = tmp - A*2;25 if(A > N + tmpC || B < 0){26 console.log("-1 -1 -1");27 }28 else{29 console.log(A+" "+B+" "+C);30 }31 }32 else{33 switch((N - tmp)%4){34 case 0:35 B = tmp - (N - tmp)/4;36 C += (N - tmp)/4*5;37 if(B < 0 || C > N + tmpC){38 console.log("-1 -1 -1");39 }40 else{41 console.log(A+" "+B+" "+C);42 }43 break;44 case 1:45 B = tmp - Math.floor((N - tmp)/4);46 C += Math.floor((N - tmp)/4)*5;47 A += 3;48 B -= 7;49 C += 5;50 if(A > N + tmpC || B < 0 || C > N + tmpC){51 console.log("-1 -1 -1");52 }53 else{54 console.log(A+" "+B+" "+C);55 }56 break;57 case 2:58 B = tmp - Math.floor((N - tmp)/4);59 C += Math.floor((N - tmp)/4)*5;60 A += 2;61 B -= 5;62 C += 5;63 if(A > N + tmpC || B < 0 || C > N + tmpC){64 console.log("-1 -1 -1");65 }66 else{67 console.log(A+" "+B+" "+C);68 }69 break;70 case 3:71 B = tmp - Math.floor((N - tmp)/4);72 C += Math.floor((N - tmp)/4)*5;73 A += 1;74 B -= 3;75 C += 5;76 if(A > N + tmpC || B < 0 || C > N + tmpC){77 console.log("-1 -1 -1");78 }79 else{80 console.log(A+" "+B+" "+C);81 }82 break;83 }84 }85 }86}87//*この行以降は編集しないでください(標準入出力から一度に読み込み、Mainを呼び出します)...

Full Screen

Full Screen

modal_html.js

Source:modal_html.js Github

copy

Full Screen

1var MODAL_HTML = {2 _confirm: function(id, t, c, l, f) { //输出confirm的html代码3 var dom_id = id;4 var tmp = '';5 tmp += '<div class="am-modal am-modal-confirm" tabindex="-1" id="' + dom_id + '">';6 tmp += ' <div class="am-modal-dialog">';7 tmp += ' <div class="am-modal-hd">{title}<span data-am-modal-close class="am-close"><i class="am-icon-times-circle"></i></span></div>';8 tmp += ' <div class="am-modal-bd">{content}</div>';9 tmp += ' <div class="am-modal-footer">';10 tmp += ' <span class="am-modal-btn" data-am-modal-cancel>{cancel}</span>';11 tmp += ' <span class="am-modal-btn" data-am-modal-confirm>{confirm}</span>';12 tmp += ' </div>';13 tmp += ' </div>';14 tmp += '</div>';15 tmp = tmp.replace('{title}', t);16 tmp = tmp.replace('{content}', c);17 tmp = tmp.replace('{cancel}', l);18 tmp = tmp.replace('{confirm}', f);19 if ($("#" + dom_id).length > 0) {20 $("#" + dom_id).remove();21 }22 $("body").append(tmp);23 },24 _alert: function(id, t, c, f) {25 var dom_id = id;26 var tmp = '';27 tmp += '<div class="am-modal am-modal-alert" tabindex="-1" id="' + dom_id + '">';28 tmp += ' <div class="am-modal-dialog">';29 tmp += ' <div class="am-modal-hd">{title}</div>';30 tmp += ' <div class="am-modal-bd">{content}</div>';31 tmp += ' <div class="am-modal-footer">';32 tmp += ' <span class="am-modal-btn">{confirm}</span>';33 tmp += ' </div>';34 tmp += ' </div>';35 tmp += '</div>';36 tmp = tmp.replace('{title}', t);37 tmp = tmp.replace('{content}', c);38 tmp = tmp.replace('{confirm}', f);39 if ($("#" + dom_id).length > 0) {40 $("#" + dom_id).remove();41 }42 $("body").append(tmp);43 },44 _prompt: function(id, t, c, l, f) {45 var dom_id = id;46 var tmp = '';47 tmp += '<div class="am-modal am-modal-prompt" tabindex="-1" id="' + dom_id + '">';48 tmp += ' <div class="am-modal-dialog">';49 tmp += ' <div class="am-modal-hd">{title}</div>';50 tmp += ' <div class="am-modal-bd">{content}<input type="text" class="am-modal-prompt-input"></div>';51 tmp += ' <div class="am-modal-footer">';52 tmp += ' <span class="am-modal-btn" data-am-modal-cancel>{cancel}</span>';53 tmp += ' <span class="am-modal-btn" data-am-modal-confirm>{confirm}</span>';54 tmp += ' </div>';55 tmp += ' </div>';56 tmp += '</div>';57 tmp = tmp.replace('{title}', t);58 tmp = tmp.replace('{content}', c);59 tmp = tmp.replace('{cancel}', l);60 tmp = tmp.replace('{confirm}', f);61 if ($("#" + dom_id).length > 0) {62 $("#" + dom_id).remove();63 }64 $("body").append(tmp);65 }...

Full Screen

Full Screen

bai6.js

Source:bai6.js Github

copy

Full Screen

1/**2 * 3 */4//bai1-phiếu 15 var can = ["Canh", "Tân", "Nhâm", "Quí", "Giáp", "Ất", "Binh", "Đinh", "Mậu", "Kỷ"];6 var chi = ["Thân", "Dậu", "Tuất", "Hợi", "Tý", "Sửu", "Dần", "Mão", "Thìn", "Tỵ", "Ngọ", "Mùi"];7function result(){8 var tmp = document.getElementById("duong");9 var x = parseInt(tmp.value);10 var tmpCan = can[x % 10];11 var tmpChi = chi[parseInt((x % 60) % 12)];12 document.getElementById("am").innerHTML = tmpCan + " " + tmpChi;13}14//bài 2 phiếu 115 var sum = 0;16 var temp = 0;17 18function bam(x) {19 temp = x;20}21function kq() {22 document.getElementById("kq").textContent = sum + temp;23 24 sum = 0;25 temp = 0;26}27function plus() {28 sum += temp;29}30//bài 2 phiếu 231function tru() {32 sum += temp;33}34function kqt() {35 document.getElementById("kqt").textContent = sum - temp;36 37 sum = 0;38 temp = 0;39}40//bài 1-phiếu 241function PTB2() {42 var a = document.getElementById("a");43 var b = document.getElementById("b");44 var c = document.getElementById("c");45 46 var tmpA = a.value;47 var tmpB = b.value;48 var tmpC = c.value;49 var x1, x2;50 51 var del = tmpB * tmpB - 4 * tmpA * tmpC;52 53 if(del < 0) {54 document.getElementById("kq").innerHTML ="Phương trình vô nghiệm";55 tmpA = tmpB = tmpC =0;56 }57 else {58 document.getElementById("kq").innerHTML ="Phương trình hai nghiệm: <br>x1 = " + ((-tmpB + Math.sqrt(del)) / (2 * tmpA)) + "<br>x2 = " + ((-tmpB - Math.sqrt(del)) / (2 * tmpA));59 tmpA = tmpB = tmpC =0;60 }61}62//bài 1 phiếu 363function PTB1() {64 var a1 = document.getElementById("a1");65 var b1 = document.getElementById("b1");66 var c1 = document.getElementById("c1");67 var a2 = document.getElementById("a2");68 var b2 = document.getElementById("b2");69 var c2 = document.getElementById("c2");70 71 var tmpA1 = a1.value;72 var tmpB1 = b1.value;73 var tmpC1 = c1.value;74 var tmpA2 = a2.value;75 var tmpB2 = b2.value;76 var tmpC2 = c2.value;77 78 document.getElementById("Gptb1").innerHTML= "Nghiệm của phương trình là: <br>x = " + ((tmpC1 - tmpB1 * (tmpA2 * tmpC1 - tmpA1 * tmpC2)/(tmpA2 * tmpB1 - tmpA1*tmpB2))/tmpA1) + "<br>y = " + ((tmpA2 * tmpC1 - tmpA1 * tmpC2)/(tmpA2 * tmpB1 - tmpA1*tmpB2));79}80//bài 2 phiếu 381function check() {82 var tmp = document.getElementById("number");83 if(tmp.value > 0 && tmp.value <= 10) {84 var kq = document.getElementById("check");85 kq.textContent="Dữ liệu đúng";86 }87 else {88 document.getElementById("check").textContent="Dữ liệu không đúng";89 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5 console.log('Test ID:', data.data.testId);6 console.log('Test URL:', data.data.summary);7 console.log('View results:', data.data.userUrl);8});9### new WebPageTest(host, key, options)

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var client = wpt('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status: ' + data.statusText);5 console.log('Test ID: ' + data.data.testId);6 console.log('Test results available at: ' + data.data.summaryCSV);7});8var wpt = require('webpagetest');9var client = wpt('www.webpagetest.org');10 if (err) return console.error(err);11 console.log('Test status: ' + data.statusText);12 console.log('Test ID: ' + data.data.testId);13 console.log('Test results available at: ' + data.data.summaryCSV);14});15var wpt = require('webpagetest');16var client = wpt('www.webpagetest.org');17 if (err) return console.error(err);18 console.log('Test status: ' + data.statusText);19 console.log('Test ID: ' + data.data.testId);20 console.log('Test results available at: ' + data.data.summaryCSV);21});22var wpt = require('webpagetest');23var client = wpt('www.webpagetest.org');24 if (err) return console.error(err);25 console.log('Test status: ' + data.statusText);26 console.log('Test ID: ' + data.data.testId);27 console.log('Test results available at: ' + data.data.summaryCSV);28});29var wpt = require('webpagetest');30var client = wpt('www.webpagetest.org');31 if (

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful