結果

問題 No.3043 yukicoderへようこそ!
ユーザー finefine
提出日時 2019-04-01 22:10:01
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 762 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-05-05 08:02:39
合計ジャッジ時間 969 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
12,288 KB
testcase_01 AC 79 ms
12,160 KB
testcase_02 AC 84 ms
12,160 KB
testcase_03 WA -
testcase_04 AC 72 ms
12,288 KB
testcase_05 AC 73 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: mismatched indentations at 'end' with 'else' at 9
Syntax OK

ソースコード

diff #

a = $<.map(&:chomp)
if a.size == 1
    if a[0].to_i == 0
        puts "Hello World!"
    else
        n = a[0].to_i
        if n % 3 == 2
            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
0