結果
問題 | No.78 クジ付きアイスバー |
ユーザー |
![]() |
提出日時 | 2015-10-21 01:14:40 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 5,000 ms |
コード長 | 311 bytes |
コンパイル時間 | 493 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-11-08 01:32:36 |
合計ジャッジ時間 | 1,721 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 35 |
ソースコード
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]) m = K/N if m < 1: print need[K] else: print need[N] if luck >= need[N] else need[N]*m-luck*(m-1) + max(0,need[K%N]-luck)