結果

問題 No.3022 縛りFizzBuzz (Easy)
ユーザー koyumeishikoyumeishi
提出日時 2017-03-31 22:51:34
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 32 ms
コンパイル使用メモリ 11,244 KB
実行使用メモリ 15,368 KB
最終ジャッジ日時 2023-09-21 11:06:14
合計ジャッジ時間 1,186 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i

three = "d".ord - "a".ord
five  = "f".ord - "a".ord

for i in ("b".ord - "a".ord )..n do
  if i % three == 0 and i % five == 0 then
    puts "FizzBuzz"
  elsif i % three == 0
    puts "Fizz"
  elsif i % five == 0
    puts "Buzz"
  else
    puts i
  end
end
0