結果

問題 No.9002 FizzBuzz(テスト用)
ユーザー namatana23namatana23
提出日時 2017-06-16 23:52:34
言語 Ruby
(3.3.0)
結果
AC  
実行時間 94 ms / 5,000 ms
コード長 286 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-08 13:59:59
合計ジャッジ時間 1,088 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
16,256 KB
testcase_01 AC 86 ms
16,256 KB
testcase_02 AC 84 ms
16,256 KB
testcase_03 AC 86 ms
16,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: mismatched indentations at 'elsif' with 'if' at 2
Main.rb:6: warning: mismatched indentations at 'elsif' with 'if' at 2
Main.rb:8: warning: mismatched indentations at 'else' with 'if' at 2
Main.rb:10: warning: mismatched indentations at 'end' with 'else' at 8
Syntax OK

ソースコード

diff #

def FizzBuzz(i)
    if i % 3 === 0 && i % 5 === 0
        puts "FizzBuzz"
        elsif i % 5 === 0
            puts "Buzz"
        elsif i % 3 === 0
            puts "Fizz"
        else
            puts i
    end
end

N = gets.to_i
i = 1
while i <= N do
    FizzBuzz(i)
    i += 1
end
0