結果
| 問題 |
No.1765 While Shining
|
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2021-11-26 22:41:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 294 bytes |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 100,080 KB |
| 最終ジャッジ日時 | 2024-06-29 18:17:18 |
| 合計ジャッジ時間 | 2,595 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 3 |
ソースコード
n = int(input())
a = list(map(int,input().split()))
ans = 0
i = 0
cnt = 0
while i <= n-2:
if a[i] == 1 and a[i+1] == 0:
cnt +=2
ans += cnt
i += 2
else:
if a[i] == 1:
ans += 1 + cnt//2
cnt = 0
i += 1
# print(ans)
print(ans)
SidewaysOwl