結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2015-01-16 23:49:51 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 490 bytes |
コンパイル時間 | 818 ms |
コンパイル使用メモリ | 101,176 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 02:03:21 |
合計ジャッジ時間 | 2,475 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 41 |
ソースコード
import std.stdio, std.conv, std.math, std.string, std.range, std.array,std.algorithm;enum MOD = 10^^9;//return ULL nCr {(n,r)|n,r ∈ (int)}ulong combination(int n, int r){if (r == 0) return 1;if (r > n/2) return combination(n,n-r);ulong ret=1;for (int i = 1; i <= r; ++i)ret = ret*(n-i+1)/i % MOD;return ret;}void main(){immutable N = readln().strip().to!long();immutable M = readln().strip().to!int();M.combination((N/1000 % M).to!int).writeln();}