結果

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

ソースコード

diff #

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