結果
| 問題 | No.78 クジ付きアイスバー |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-30 10:52:31 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 194 ms / 5,000 ms |
| コード長 | 346 bytes |
| 記録 | |
| コンパイル時間 | 140 ms |
| コンパイル使用メモリ | 77,240 KB |
| 最終ジャッジ日時 | 2025-12-03 21:41:41 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
#yuki_78 n,k=map(int,raw_input().split()) s=raw_input() res=0 point=cost=0 if k>=n: for i in xrange(n): if point==0: cost+=1 else: point-=1 point+=int(s[i]) res+=cost k=k-n res+=k/n*max(cost-point,0) cost2=0 point2=point for i in xrange(k%n): if point2==0: cost2+=1 else: point2-=1 point2+=int(s[i]) res+=cost2 print res