結果
| 問題 | No.1765 While Shining |
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2021-11-26 22:44:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 354 bytes |
| 記録 | |
| コンパイル時間 | 130 ms |
| コンパイル使用メモリ | 82,392 KB |
| 実行使用メモリ | 99,072 KB |
| 最終ジャッジ日時 | 2024-06-29 18:18:34 |
| 合計ジャッジ時間 | 2,441 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 1 |
ソースコード
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:
if i == n-2:
cnt += 1
else:
cnt +=2
ans += cnt
i += 2
else:
if a[i] == 1:
ans += 1 + cnt//2
cnt = 0
i += 1
# print(ans)
print(ans)
SidewaysOwl