結果

問題 No.1765 While Shining
ユーザー ibukitiibukiti
提出日時 2021-12-03 08:53:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 362 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 87,304 KB
実行使用メモリ 109,128 KB
最終ジャッジ日時 2023-09-19 00:01:33
合計ジャッジ時間 7,076 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
75,852 KB
testcase_01 AC 69 ms
71,464 KB
testcase_02 AC 69 ms
71,644 KB
testcase_03 AC 69 ms
71,332 KB
testcase_04 AC 69 ms
71,324 KB
testcase_05 AC 68 ms
71,340 KB
testcase_06 AC 67 ms
71,272 KB
testcase_07 AC 66 ms
71,436 KB
testcase_08 AC 69 ms
71,332 KB
testcase_09 AC 98 ms
93,416 KB
testcase_10 AC 111 ms
104,756 KB
testcase_11 AC 109 ms
98,692 KB
testcase_12 AC 108 ms
101,668 KB
testcase_13 AC 113 ms
98,796 KB
testcase_14 AC 112 ms
104,940 KB
testcase_15 AC 116 ms
104,980 KB
testcase_16 AC 115 ms
105,232 KB
testcase_17 AC 113 ms
104,884 KB
testcase_18 AC 113 ms
105,056 KB
testcase_19 AC 116 ms
105,060 KB
testcase_20 AC 117 ms
104,996 KB
testcase_21 AC 115 ms
105,048 KB
testcase_22 AC 116 ms
105,060 KB
testcase_23 AC 119 ms
104,844 KB
testcase_24 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
    tmp=1
    if a[i]==1:
        ans+=1
        for j in range(i+1,n-1):
            if tmp==1 and a[j]==0:
                tmp=0
                ans+=1
            elif tmp==0 and a[j]==1:
                tmp=1
                ans+=1
            else :
                break
print(ans)
0