結果
問題 | No.420 mod2漸化式 |
ユーザー |
|
提出日時 | 2016-09-09 23:02:24 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 1,547 ms |
コンパイル使用メモリ | 159,252 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 04:15:38 |
合計ジャッジ時間 | 2,250 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
ソースコード
import std.algorithm, std.array, std.container, std.range, std.bitmanip;import std.numeric, std.math, std.bigint, std.random, core.bitop;import std.string, std.regex, std.conv, std.stdio, std.typecons;void main(){auto x = readln.chomp.to!int;if (x > 31) {writeln(0, " ", 0);} else if (x == 0) {writeln(1, " ", 0);} else {auto a = nCr(31, x);auto b = ((1L << 31) - 1) * nCr(30, x - 1);writeln(a, " ", b);}}BigInt nCr(int n, int k){BigInt r = 1;foreach (i; 1..n + 1)r *= BigInt(i);foreach (i; 1..k + 1)r /= BigInt(i);foreach (i; 1..(n - k) + 1)r /= BigInt(i);return r;}