結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー Nakamura
提出日時 2023-07-01 13:37:57
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 39,168 KB
最終ジャッジ日時 2024-07-08 00:02:29
合計ジャッジ時間 740 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

const main = input => {
	const N = Number(input.trim());
	
	const ans = []
	for (let i = 1; i < N + 1; i++) {
		if (i % 3 === 0 && i % 5 === 0) {
			ans.push('FizzBuzz');
		} else if (i % 3 === 0) {
			ans.push('Fizz');
		} else if (i % 5 === 0) {
			ans.push('Buzz');
		} else {
			ans.push(i);
		}
	}
	
	console.log(ans.join('\n'));
}

const input = require('fs').readFileSync('/dev/stdin', 'utf8');
main(input);
0