题解 | #循环数比较#
循环数比较
https://www.nowcoder.com/practice/24575008c6134b6fa4fab8ea0ea82a99?tpId=182&tqId=34530&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26pageSize%3D50%26search%3D%26tab%3D%25E5%2590%258D%25E4%25BC%2581%25E7%259C%259F%25E9%25A2%2598%26topicId%3D182&difficulty=undefined&judgeStatus=undefined&tags=&title=
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here m = await readline(); arr = m.split(' '); let arrs = new Array; for(let i=0; i<4; i++){ arrs.push(parseInt(arr[i])); } var v1wei = getwei(arrs[0],0); var v2wei = getwei(arrs[2],0); var repeat1 = repeat(arr[0],arrs[1]) let num1 = parseInt(repeat1); var repeat2 = repeat(arr[2],arrs[3]) let num2 = parseInt(repeat2); if(v1wei*arrs[1]>v2wei*arrs[3]){ console.log("Greater"); }else if(v2wei*arrs[3]>v1wei*arrs[1]){ console.log('Less'); }else{ if(num1>num2){ console.log("Greater"); }else if(num2>num1){ console.log('Less'); }else{ console.log("Equal"); } } function getwei(n,m){ while(Math.floor(n/10)){ n=n/10; m+=1; } return m+1; } function repeat(n,m){ let str = n; for(let i=0; i<m-1; i++){ str +=n; } return str; } }()