結果

問題 No.250 atetubouのzetubou
ユーザー te-sh
提出日時 2017-05-25 17:22:45
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2,362 ms / 5,000 ms
コード長 645 bytes
コンパイル時間 1,356 ms
コンパイル使用メモリ 148,500 KB
実行使用メモリ 24,148 KB
最終ジャッジ日時 2024-06-12 19:25:42
合計ジャッジ時間 26,899 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.bigint;    // BigInt

void main()
{
  auto q = readln.chomp.to!size_t;
  auto di = new int[](q), xi = new int[](q), ti = new long[](q);
  foreach (i; 0..q) {
    auto rd = readln.split;
    di[i] = rd[0].to!int; xi[i] = rd[1].to!int; ti[i] = rd[2].to!long;
  }

  auto maxXD = zip(di, xi).map!"a[0] + a[1]".maxElement;
  auto facts = new BigInt[](maxXD);
  facts[0] = 1;
  foreach (i; 1..maxXD)
    facts[i] = facts[i-1] * i;

  foreach (d, x, t; lockstep(di, xi, ti)) {
    auto c = facts[x+d-1] / facts[x] / facts[d-1];
    writeln(c <= t ? "AC" : "ZETUBOU");
  }
}
0