結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー swyroakswyroak
提出日時 2021-07-20 20:40:02
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 5,208 KB
実行使用メモリ 42,456 KB
最終ジャッジ日時 2023-09-24 12:55:16
合計ジャッジ時間 953 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
42,168 KB
testcase_01 AC 83 ms
42,332 KB
testcase_02 AC 85 ms
42,228 KB
testcase_03 AC 84 ms
42,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。
    let N=[...Array(Number(input)).keys()].map(i=>i+1)
    N.forEach(function (currentValue) {
        
        let Answer=""
        //3の倍数はFizz
        if (currentValue%3===0) {
            Answer="Fizz"
        }
        //5の倍数はBuzz
        if (currentValue%5===0) {
            Answer+="Buzz"
        }
        
        if (Answer==="") {
            Answer=currentValue
        }
        
        console.log(Answer)
    });
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0