結果

問題 No.78 クジ付きアイスバー
ユーザー c-yanc-yan
提出日時 2021-02-16 01:24:04
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 10,728 KB
実行使用メモリ 8,176 KB
最終ジャッジ日時 2023-09-30 23:12:55
合計ジャッジ時間 2,598 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,044 KB
testcase_01 AC 15 ms
8,172 KB
testcase_02 AC 16 ms
7,768 KB
testcase_03 AC 16 ms
8,100 KB
testcase_04 AC 20 ms
7,688 KB
testcase_05 AC 15 ms
8,052 KB
testcase_06 AC 16 ms
8,032 KB
testcase_07 AC 15 ms
8,116 KB
testcase_08 AC 15 ms
8,056 KB
testcase_09 AC 15 ms
8,048 KB
testcase_10 AC 14 ms
8,160 KB
testcase_11 AC 14 ms
8,048 KB
testcase_12 AC 16 ms
8,172 KB
testcase_13 AC 16 ms
8,164 KB
testcase_14 AC 15 ms
7,968 KB
testcase_15 AC 16 ms
8,164 KB
testcase_16 AC 15 ms
8,168 KB
testcase_17 AC 14 ms
8,064 KB
testcase_18 AC 14 ms
8,160 KB
testcase_19 AC 15 ms
7,760 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 16 ms
7,868 KB
testcase_23 AC 14 ms
8,176 KB
testcase_24 AC 16 ms
8,056 KB
testcase_25 AC 15 ms
8,164 KB
testcase_26 AC 16 ms
8,052 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 15 ms
7,760 KB
testcase_31 AC 14 ms
7,812 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 14 ms
7,808 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 15 ms
8,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
S = input()


def f(stock, S):
    pay = 0
    for c in S:
        if stock == 0:
            pay += 1
        else:
            stock -= 1
        stock += int(c)
    return pay, stock


if K <= N:
    print(f(0, S[:K])[0])
    exit()

pay, stock = f(0, S)

if stock >= pay:
    print(pay)
    exit()

print(pay + (pay - stock) * (K - N) // N + f(stock, S[:K % N])[0])
0