結果
| 問題 | 
                            No.1765 While Shining
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ibukiti
                         | 
                    
| 提出日時 | 2021-12-03 08:40:55 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 336 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 13,712 KB | 
| 最終ジャッジ日時 | 2024-07-05 12:48:04 | 
| 合計ジャッジ時間 | 2,471 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 3 | 
| other | AC * 1 RE * 21 | 
ソースコード
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)
            
            
            
        
            
ibukiti