結果
問題 | No.884 Eat and Add |
ユーザー | H3PO4 |
提出日時 | 2021-03-06 09:19:34 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 158 ms / 1,000 ms |
コード長 | 264 bytes |
コンパイル時間 | 78 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 14,152 KB |
最終ジャッジ日時 | 2024-04-16 22:07:26 |
合計ジャッジ時間 | 2,003 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,752 KB |
testcase_01 | AC | 31 ms
10,624 KB |
testcase_02 | AC | 33 ms
10,752 KB |
testcase_03 | AC | 139 ms
14,024 KB |
testcase_04 | AC | 139 ms
14,020 KB |
testcase_05 | AC | 141 ms
14,152 KB |
testcase_06 | AC | 137 ms
14,028 KB |
testcase_07 | AC | 131 ms
14,148 KB |
testcase_08 | AC | 119 ms
14,024 KB |
testcase_09 | AC | 158 ms
14,152 KB |
testcase_10 | AC | 30 ms
10,624 KB |
testcase_11 | AC | 31 ms
10,752 KB |
ソースコード
N = [0] + [int(x) for x in input()] cur = len(N) - 1 ans = 0 while cur: if N[cur] == N[cur - 1] == 1: ans += 1 while N[cur]: N[cur] = 0 cur -= 1 N[cur] = 1 else: cur -= 1 ans += N.count(1) print(ans)