結果

問題 No.45 回転寿司
ユーザー nanae
提出日時 2017-03-02 19:53:36
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 1,370 ms
コンパイル使用メモリ 118,816 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 07:10:10
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.string, std.conv, std.array, std.algorithm;
import std.uni, std.math, std.container;
import core.bitop, std.datetime;

void main(){
    int N = readln.chomp.to!int;
    auto V = readln.split.to!(int[]);
    int toreru = 0, torenai = 0;

    foreach(v ; V){
        int tmp = toreru;
        toreru = torenai;
        torenai = max(torenai, tmp + v);
    }

    writeln(max(toreru, torenai));
}
0