結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-01-17 00:40:25 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 18 ms / 5,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 703 ms |
コンパイル使用メモリ | 109,172 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 02:04:56 |
合計ジャッジ時間 | 2,014 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
import std.stdio, std.conv, std.math, std.string, std.range, std.array,std.algorithm, std.bigint;//return ULL nCr {(n,r)|n,r ∈ (int)}BigInt combination(int n, int r){if (r == 0) return BigInt(1);if (r > n/2) return combination(n,n-r);BigInt ret=1;for (int i = 1; i <= r; ++i)ret = ret*(n-i+1)/i;return ret;}void main(){immutable N = readln().strip().to!long();immutable M = readln().strip().to!int();(M.combination(((N/1000)%M).to!int) % 10^^9).writeln();}