提出 #601351


ソースコード 拡げる

import std.stdio;
import std.string;
import std.algorithm;
import std.conv;

void main(string[] args)
{
  auto numbers = readln().chomp().split(" ").map!(to!int);

  // 5C3 = 10
  int[] sums = new int[10];
  int[] indices = [2, 1, 0];
  for(int i = 0; i < 10; i++) {
    sums[i] =
      numbers[indices[0]] + numbers[indices[1]] + numbers[indices[2]];

    indices[0]++;
    if (indices[0] >= numbers.length) {
      indices[1]++;
      indices[0] = indices[1] + 1;
      if (indices[1] >= numbers.length - 1) {
        indices[2]++;
        indices[1] = indices[2] + 1;
        indices[0] = indices[1] + 1;
      }
    }
  }
  
  sums.sort!("a > b");
  writefln("%d", sums[2]);
}

提出情報

提出日時
問題 C - 数を3つ選ぶマン
ユーザ tana_ash
言語 D (DMD 2.066.1)
得点 100
コード長 712 Byte
結果 AC
実行時間 26 ms
メモリ 924 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 2
AC × 15
セット名 テストケース
Sample example_0.txt, example_1.txt
All example_0.txt, example_1.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, handmade_4.txt, handmade_5.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, example_0.txt, example_1.txt
ケース名 結果 実行時間 メモリ
example_0.txt AC 25 ms 920 KiB
example_1.txt AC 24 ms 920 KiB
handmade_0.txt AC 26 ms 916 KiB
handmade_1.txt AC 26 ms 916 KiB
handmade_2.txt AC 25 ms 800 KiB
handmade_3.txt AC 26 ms 920 KiB
handmade_4.txt AC 26 ms 924 KiB
handmade_5.txt AC 26 ms 792 KiB
random_0.txt AC 26 ms 924 KiB
random_1.txt AC 23 ms 796 KiB
random_2.txt AC 26 ms 792 KiB
random_3.txt AC 24 ms 800 KiB
random_4.txt AC 23 ms 800 KiB