結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー kaiyori_labkaiyori_lab
提出日時 2015-01-09 02:51:40
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 166,100 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-02 19:35:58
合計ジャッジ時間 3,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.algorithm;
import std.math;
import std.range;
import std.conv;
import std.typecons;

// solve =============
T solve(T)(T[] xs, T acc = 0){
  xs.sort.reverse;
  xs.writeln;
  if( xs[2] == 0 ) return acc; else { acc += xs[2]; xs[0..3] -= xs[2]; }
  return solve(xs, acc);
}

// main ===============
void main(){

  readln;
  foreach(line; stdin.byLine){
    if(line.empty) break;
    auto ls = readln.chomp.split(" ").map!(to!int).array.sort;
    auto groupLs = ls.group.map!("a[1]").array;  //uint
    writeln( groupLs.length >= 3 ? solve(groupLs) : 0 );
  }
}
0