結果
| 問題 |
No.884 Eat and Add
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-13 22:15:39 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 1,000 ms |
| コード長 | 346 bytes |
| コンパイル時間 | 1,553 ms |
| コンパイル使用メモリ | 76,716 KB |
| 実行使用メモリ | 80,128 KB |
| 最終ジャッジ日時 | 2024-07-04 09:52:05 |
| 合計ジャッジ時間 | 3,400 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
def solve(A):
dp0 = 0
dp1 = 1 << 30
for x in A:
if x:
dp0,dp1 = min(dp0+1, dp1+2), min(dp0, dp1)
else:
dp0,dp1 = min(dp0, dp1+2), min(dp0,dp1)+1
return min(dp0, dp1 + 2)
print solve(map(int, rr()))