結果

問題 No.523 LED
ユーザー GrenacheGrenache
提出日時 2017-06-02 22:36:08
言語 Java19
(openjdk 21)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 975 bytes
コンパイル時間 4,933 ms
コンパイル使用メモリ 77,312 KB
実行使用メモリ 57,632 KB
最終ジャッジ日時 2023-10-21 21:05:48
合計ジャッジ時間 8,961 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
56,292 KB
testcase_01 AC 119 ms
57,632 KB
testcase_02 AC 122 ms
57,472 KB
testcase_03 AC 117 ms
57,624 KB
testcase_04 AC 115 ms
57,200 KB
testcase_05 AC 262 ms
56,220 KB
testcase_06 AC 122 ms
57,420 KB
testcase_07 AC 119 ms
57,532 KB
testcase_08 AC 117 ms
57,444 KB
testcase_09 AC 119 ms
57,620 KB
testcase_10 AC 111 ms
57,476 KB
testcase_11 AC 112 ms
57,360 KB
testcase_12 AC 112 ms
57,368 KB
testcase_13 AC 144 ms
57,384 KB
testcase_14 AC 106 ms
56,984 KB
testcase_15 AC 110 ms
57,340 KB
testcase_16 AC 106 ms
56,960 KB
testcase_17 AC 111 ms
57,368 KB
testcase_18 AC 244 ms
56,320 KB
testcase_19 AC 170 ms
57,396 KB
testcase_20 AC 166 ms
57,376 KB
testcase_21 AC 214 ms
56,232 KB
testcase_22 AC 236 ms
57,332 KB
testcase_23 AC 223 ms
56,252 KB
testcase_24 AC 124 ms
57,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder523 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		long inv2 = pow(2, MOD - 2);

		long ret = 1;
		for (int i = 1; i <= 2 * n; i++) {
			ret *= i;
			ret %= MOD;
		}

		for (int i = 0; i < n; i++) {
			ret *= inv2;
			ret %= MOD;
		}

		pr.println(ret);
	}

	private static final int MOD = 1_000_000_007;

	private static long pow(int a, int n) {
		long loop = n;
		long ret = 1;
		long x = a;
		while (loop > 0) {
			if (loop % 2 == 1) {
				ret = ret * x % MOD;
			}
			x = x * x % MOD;
			loop /= 2;
		}

		return ret;
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0