結果

問題 No.1765 While Shining
ユーザー SidewaysOwl
提出日時 2021-11-26 22:43:54
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 280 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 67,084 KB
最終ジャッジ日時 2024-06-29 18:18:28
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0