結果
問題 | No.8043 yukicoderへようこそ! |
ユーザー |
|
提出日時 | 2019-04-01 22:11:12 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 91 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-11-27 03:01:45 |
合計ジャッジ時間 | 1,121 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
Main.rb:21: warning: mismatched indentations at 'end' with 'else' at 9 Syntax OK
ソースコード
a = $<.map(&:chomp) if a.size == 1 if a[0].to_i == 0 puts "Hello World!" else n = a[0].to_i if n % 2 == 0 p n * (n + 1) / 2 else 1.upto(n) do |x| if x % 15 == 0 puts "FizzBuzz" elsif x % 5 == 0 puts "Buzz" elsif x % 3 == 0 puts "Fizz" else p x end end end end elsif a.size == 2 b = a[0].split if b.size == 1 n = b[0].to_i p a[1].split.map(&:to_i).inject(:+) else x, y = b.map(&:to_i) puts "#{x + y} #{a[1]}" end else n = a[0].to_i ans = 0 1.upto(n) do |i| ans += a[i].to_i end p ans end