結果
| 問題 | 
                            No.45 回転寿司
                             | 
                    
| ユーザー | 
                             JunOnuma
                         | 
                    
| 提出日時 | 2017-05-24 11:53:36 | 
| 言語 | Python2  (2.7.18)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 13 ms / 5,000 ms | 
| コード長 | 205 bytes | 
| コンパイル時間 | 389 ms | 
| コンパイル使用メモリ | 6,784 KB | 
| 実行使用メモリ | 6,272 KB | 
| 最終ジャッジ日時 | 2024-12-27 16:22:24 | 
| 合計ジャッジ時間 | 2,106 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 30 | 
ソースコード
n = int(raw_input())
l = map(int, raw_input().split())
if n == 1:
    print l[0]
else:
    ll = [l[0],max(l[0],l[1])]
    for i in range(2,n):
        ll.append(max(ll[i-1],ll[i-2]+l[i]))
    print ll[-1]
            
            
            
        
            
JunOnuma