結果

問題 No.1765 While Shining
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-26 22:38:20
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 306 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 105,200 KB
最終ジャッジ日時 2023-09-12 05:15:46
合計ジャッジ時間 5,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 79 ms
71,168 KB
testcase_02 AC 75 ms
71,196 KB
testcase_03 AC 74 ms
71,396 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 74 ms
71,320 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 104 ms
97,920 KB
testcase_12 RE -
testcase_13 AC 105 ms
97,972 KB
testcase_14 AC 115 ms
104,580 KB
testcase_15 RE -
testcase_16 AC 114 ms
104,572 KB
testcase_17 AC 113 ms
104,620 KB
testcase_18 RE -
testcase_19 AC 113 ms
104,500 KB
testcase_20 AC 113 ms
104,512 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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