結果

問題 No.78 クジ付きアイスバー
ユーザー zazaboonzazaboon
提出日時 2017-02-03 18:22:23
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 11,380 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2023-08-25 18:27:21
合計ジャッジ時間 4,820 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,128 KB
testcase_01 AC 77 ms
15,120 KB
testcase_02 WA -
testcase_03 AC 78 ms
15,292 KB
testcase_04 AC 81 ms
15,124 KB
testcase_05 AC 77 ms
15,248 KB
testcase_06 AC 78 ms
15,260 KB
testcase_07 AC 78 ms
15,132 KB
testcase_08 AC 78 ms
15,040 KB
testcase_09 AC 78 ms
15,284 KB
testcase_10 AC 79 ms
15,060 KB
testcase_11 AC 78 ms
15,060 KB
testcase_12 AC 78 ms
15,296 KB
testcase_13 AC 78 ms
15,100 KB
testcase_14 AC 77 ms
15,040 KB
testcase_15 AC 79 ms
15,060 KB
testcase_16 AC 76 ms
15,144 KB
testcase_17 AC 77 ms
15,164 KB
testcase_18 AC 77 ms
15,340 KB
testcase_19 AC 77 ms
15,104 KB
testcase_20 AC 77 ms
15,132 KB
testcase_21 WA -
testcase_22 AC 77 ms
15,136 KB
testcase_23 AC 77 ms
15,300 KB
testcase_24 AC 77 ms
15,168 KB
testcase_25 AC 78 ms
15,292 KB
testcase_26 AC 77 ms
15,256 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 78 ms
15,064 KB
testcase_31 AC 77 ms
15,092 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 78 ms
15,260 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 76 ms
15,268 KB
testcase_38 AC 77 ms
15,140 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:44: warning: mismatched indentations at 'end' with 'if' at 41
Syntax OK

ソースコード

diff #

# Here your code !
n,k = gets.chomp.split(" ").map(&:to_i)
t = gets.chomp.split("").map(&:to_i)
a = 0
b = 0
c = 0
t.each do |d|
    if(b >= k)
        puts a
        exit
    end
    b += 1
    if(c > 0)
        c -= 1
    else
        a += 1
    end
    c += d
end
r = 0
t.each do |d|
    if(c > 0)
        c -= 1
    else
        r += 1
    end
    c += d
end
m = k - b
a += m * r / n
b += a * n
t.each do |d|

    b += 1
    if(c > 0)
        c -= 1
    else
        a += 1
    end
    c += d
        if(b >= k)
        puts a
        exit
    end
end
puts a
0