結果

問題 No.129 お年玉(2)
ユーザー te-shte-sh
提出日時 2017-01-30 17:34:35
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 1,717 ms
コンパイル使用メモリ 154,968 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-03 01:04:27
合計ジャッジ時間 4,628 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 65 ms
7,952 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 25 ms
7,932 KB
testcase_06 AC 14 ms
7,948 KB
testcase_07 AC 30 ms
7,948 KB
testcase_08 AC 34 ms
7,948 KB
testcase_09 AC 12 ms
7,972 KB
testcase_10 AC 35 ms
7,912 KB
testcase_11 AC 18 ms
7,932 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 14 ms
7,968 KB
testcase_15 AC 14 ms
7,940 KB
testcase_16 AC 19 ms
7,964 KB
testcase_17 AC 10 ms
7,944 KB
testcase_18 AC 31 ms
7,928 KB
testcase_19 AC 44 ms
7,964 KB
testcase_20 AC 22 ms
7,916 KB
testcase_21 AC 11 ms
7,972 KB
testcase_22 AC 22 ms
7,924 KB
testcase_23 AC 33 ms
7,980 KB
testcase_24 AC 54 ms
7,964 KB
testcase_25 AC 17 ms
7,984 KB
testcase_26 AC 27 ms
7,944 KB
testcase_27 AC 24 ms
7,932 KB
testcase_28 AC 21 ms
7,960 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 4 ms
4,380 KB
testcase_39 AC 4 ms
4,380 KB
testcase_40 AC 8 ms
6,932 KB
testcase_41 AC 13 ms
7,928 KB
testcase_42 AC 8 ms
6,884 KB
testcase_43 AC 2 ms
4,380 KB
testcase_44 AC 54 ms
7,912 KB
testcase_45 AC 5 ms
4,384 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 44 ms
7,940 KB
testcase_48 AC 35 ms
7,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const auto p = BigInt(10) ^^ 9;

void main()
{
  auto n = readln.chomp.to!BigInt;
  auto m = readln.chomp.to!BigInt;

  auto k = (n / 1000) % m;
  auto r1 = iota(m - k + 1, m + 1).fold!((a, b) => a * b)(BigInt(1));
  auto r2 = iota(1, k + 1).fold!((a, b) => a * b)(BigInt(1));

  writeln((r1 / r2) % p);
}
0