結果

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

ソースコード

diff #

N,K = map(int,raw_input().split())
S = raw_input()
need = [0]*(N+1)
luck = 0
for i in xrange(N):
	need[i+1] = need[i]
	if luck == 0:
		need[i+1] += 1
	else:
		luck -= 1
	luck += int(S[i])
if luck >= need[N]:
	print 1
else:
	m = K/N
	print need[K] if m < 1 else need[N]*m-luck*(m-1) + max(0,need[K%N]-luck)
0