結果

問題 No.1765 While Shining
コンテスト
ユーザー ibukiti
提出日時 2021-12-03 08:40:55
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 336 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 558 ms
コンパイル使用メモリ 20,952 KB
実行使用メモリ 22,336 KB
最終ジャッジ日時 2026-03-26 21:37:04
合計ジャッジ時間 7,668 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other AC * 1 RE * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=int(input())
a=map(int,input().split())
tmp=1
ans=0
for i in range(n-1):
    if a[i]==1:
        for j in range(i+1,n):
            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