結果

問題 No.1765 While Shining
ユーザー ibukiti
提出日時 2021-12-03 08:53:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 362 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 82,504 KB
実行使用メモリ 108,988 KB
最終ジャッジ日時 2024-07-05 13:00:58
合計ジャッジ時間 6,114 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

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