結果

問題 No.549 素材合成システム
ユーザー nanae
提出日時 2017-05-16 18:44:57
言語 D
(dmd 2.109.1)
結果
TLE  
実行時間 -
コード長 747 bytes
コンパイル時間 952 ms
コンパイル使用メモリ 121,256 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-06-12 19:17:33
合計ジャッジ時間 5,427 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 TLE * 1 -- * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void main(){
    int N;
    readVars(N);
    auto x = readln.split.to!(int[]);

    int ans = 0;

    foreach(i ; 0 .. N){
        int tmp = x[i];

        foreach(j ; 0 .. N){
            if(j != i){
                tmp += x[j] / 2;
            }
        }

        ans = max(ans, tmp);
    }

    writeln(ans);
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}
0