結果
| 問題 | No.1765 While Shining |
| コンテスト | |
| ユーザー |
SidewaysOwl
|
| 提出日時 | 2021-11-26 22:38:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 306 bytes |
| 記録 | |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 82,340 KB |
| 実行使用メモリ | 105,088 KB |
| 最終ジャッジ日時 | 2024-06-29 18:16:06 |
| 合計ジャッジ時間 | 2,905 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 1 |
| other | AC * 9 WA * 1 RE * 12 |
ソースコード
n = int(input())
a = list(map(int,input().split()))
ans = 0
flg = a[0]
i = 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