結果

問題 No.523 LED
ユーザー nebukuro09nebukuro09
提出日時 2017-06-03 12:30:46
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 101,268 KB
実行使用メモリ 160,692 KB
最終ジャッジ日時 2023-09-03 13:56:37
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 168 ms
159,260 KB
testcase_01 AC 169 ms
159,684 KB
testcase_02 AC 169 ms
159,296 KB
testcase_03 AC 169 ms
159,604 KB
testcase_04 AC 168 ms
160,384 KB
testcase_05 AC 168 ms
159,944 KB
testcase_06 AC 168 ms
159,412 KB
testcase_07 AC 168 ms
159,348 KB
testcase_08 AC 170 ms
159,280 KB
testcase_09 AC 170 ms
159,692 KB
testcase_10 AC 169 ms
159,764 KB
testcase_11 AC 169 ms
159,848 KB
testcase_12 AC 169 ms
159,796 KB
testcase_13 AC 168 ms
160,332 KB
testcase_14 AC 168 ms
160,692 KB
testcase_15 AC 168 ms
160,404 KB
testcase_16 AC 169 ms
160,152 KB
testcase_17 AC 169 ms
159,996 KB
testcase_18 AC 168 ms
159,548 KB
testcase_19 AC 172 ms
159,268 KB
testcase_20 AC 170 ms
160,232 KB
testcase_21 AC 169 ms
159,748 KB
testcase_22 AC 170 ms
159,628 KB
testcase_23 AC 169 ms
159,340 KB
testcase_24 AC 170 ms
159,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
}
0