結果

問題 No.78 クジ付きアイスバー
ユーザー Watson
提出日時 2017-08-01 15:52:49
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 17,444 KB
最終ジャッジ日時 2024-10-11 05:46:47
合計ジャッジ時間 7,277 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 1 TLE * 1 -- * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = [int(i) for i in input().split()]
S = list(input())
eat = 1
box = 1
luck = int(S[0])
buy = 1
while eat < K:
    eat += 1
    if eat != K:    
        if luck == 0:
            buy += 1
        else:
            luck -= 1
        luck += int(S[box])
        box += 1
        if box >= N-1:
            box = 0
print(buy)
0