250x250
Notice
Recent Posts
Recent Comments
Link
\(@^0^@)/
[JS] ๋ฐฑ์ค 1110๋ฒ ๋ํ๊ธฐ ์ฌ์ดํด ๋ณธ๋ฌธ
728x90
๐ฑ๐ 1. ๋ฌธ์ : 1110
https://www.acmicpc.net/problem/1110
๐ฅ 2. ์ฝ๋์ ํ์ด
const fs = require('fs');
const file = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(file).toString();
let plus = 0
let count = 0;
let num = Number(input);
let trueOrfalse = true;
// 2+6 = 8
// 1. 6+8 = 14
// 2. 8+4 = 12
// 3. 4+2 = 6
// 4. 2+6 = 8
while(trueOrfalse) {
// ์์ input 26
// (26/10) + (26%10) => 2(2.666) + 6 => 2 + 6 => 8
plus = Math.floor(num/10) + (num % 10);
// (26%10)* 10 + (8%10) => 60 + 8 => 68
num = (num % 10) * 10 + (plus % 10);
count++;
if(num == input){
console.log(count);
trueOrfalse = false;
}
}
728x90
'์๊ณ ๋ฆฌ์ฆ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] ๋ฐฑ์ค 3052๋ฒ ๋๋จธ์ง (0) | 2021.09.28 |
---|---|
[JS] ๋ฐฑ์ค 2577๋ฒ ์ซ์์ ๊ฐ์ (0) | 2021.09.28 |
[JS] ๋ฐฑ์ค 10952๋ฒ A+B - 5 (0) | 2021.09.24 |
[JS] ๋ฐฑ์ค 2439๋ฒ ๋ณ ์ฐ๊ธฐ - 2 (0) | 2021.09.17 |
[JS] ๋ฐฑ์ค 15552๋ฒ ๋น ๋ฅธ A+B (0) | 2021.09.17 |