結果
| 問題 |
No.523 LED
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-03 12:30:46 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 2,000 ms |
| コード長 | 683 bytes |
| コンパイル時間 | 876 ms |
| コンパイル使用メモリ | 113,024 KB |
| 実行使用メモリ | 158,720 KB |
| 最終ジャッジ日時 | 2024-06-12 19:44:09 |
| 合計ジャッジ時間 | 5,565 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;
immutable long MOD = 10^^9 + 7;
immutable long MAX = 10^^7;
long powmod(long a, long x, long m) {
long ret = 1;
while (x) {
if (x % 2) ret = ret * a % m;
a = a * a % m;
x /= 2;
}
return ret;
}
void main() {
auto N = readln.chomp.to!int;
auto F = new long[](MAX*2+1);
F[0] = F[1] = 1;
foreach (i; 1..MAX*2) {
F[i+1] = F[i] * (i + 1) % MOD;
}
long ans = F[N * 2] * powmod(powmod(2, MOD-2, MOD), N, MOD) % MOD;
ans.writeln;
}