結果
| 問題 |
No.9002 FizzBuzz(テスト用)
|
| ユーザー |
|
| 提出日時 | 2020-07-23 10:50:48 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 5,000 ms |
| コード長 | 667 bytes |
| コンパイル時間 | 96 ms |
| コンパイル使用メモリ | 6,940 KB |
| 実行使用メモリ | 39,296 KB |
| 最終ジャッジ日時 | 2024-06-23 17:25:47 |
| 合計ジャッジ時間 | 825 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
ソースコード
function main(input = '') {
if (!input) throw Error;
// let lines = input.split('\n');
// let [a, b] = lines[0].split(' ');
let list = [];
for (let i = 1; i <= parseInt(input); i++) {
if (i % 3 === 0) {
if (i % 5 === 0) {
list.push('FizzBuzz');
} else {
list.push('Fizz');
}
} else if (i % 5 === 0) {
list.push('Buzz');
} else {
list.push(String(i));
}
}
return list.join('\n');
}
const { readFileSync, existsSync } = require('fs');
const stdin = '/dev/stdin';
if (existsSync(stdin)) {
const input = readFileSync(stdin, 'utf8');
console.log(main(input));
}
module.exports = main;