結果
| 問題 | No.78 クジ付きアイスバー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-18 22:30:06 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 25 ms / 5,000 ms |
| + 186µs | |
| コード長 | 389 bytes |
| 記録 | |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 82,076 KB |
| 実行使用メモリ | 56,464 KB |
| 最終ジャッジ日時 | 2026-10-10 16:19:41 |
| 合計ジャッジ時間 | 3,300 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 36 |
ソースコード
n,k=map(int,input().split())
s=list(map(int,list(input())))
c=0;d=0;
for i in s:
if d:
d-=1;d+=i
else:
c+=1;d+=i
if c+d>=k:
print(c);exit()
k-=n
if d>=c:
print(c)
else:
ans=c+(k//n*(c-d))
k%=n
for i in s:
if k==0:
break
if d:
d-=1
else:
ans+=1
d+=i;k-=1
print(ans)