
const fs = require('fs');
const path = process.platform === 'linux' ? '/dev/stdin' : 'Wiki\\input.txt';
let n = Number(fs.readFileSync(path));
let ans = '';
while (true) {
if (n === 0) {
ans += 'int';
break;
} else {
ans += 'long';
n -= 4;
}
ans += ' ';
}
console.log(ans);
⏰ 소요한 시간 : -
무한반복을 하면서 n이 0이 될 때까지 4씩 빼면서 long을 출력하면 된다.
n이 0이되는순간 int를 출력해줘야 하는데 혹시 몰라서 ans 문자열에 더해 한번의 콘솔만 찍히게 했다.