結果
| 問題 | No.1765 While Shining |
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2021-11-26 22:50:24 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 367 bytes |
| 記録 | |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 99,072 KB |
| 最終ジャッジ日時 | 2026-03-19 08:23:22 |
| 合計ジャッジ時間 | 2,251 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
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:
ans += 1 + cnt//2
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