結果

問題 No.78 クジ付きアイスバー
ユーザー steek79
提出日時 2015-10-21 23:16:35
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 13,092 KB
最終ジャッジ日時 2024-10-06 18:27:07
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 15 WA * 1 TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0
free = 0
eaten = 0

while True:
    for i in xrange(len(S)):
        if free > 0:
            free -= 1
        else:
            ans += 1

        eaten += 1
        free += int(S[i])

        if eaten == K:
            print ans
            exit()
    if free > 0:
        print ans
        exit()
0