結果

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

ソースコード

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