結果

問題 No.523 LED
ユーザー tentententen
提出日時 2022-10-14 14:46:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 1,462 bytes
コンパイル時間 1,941 ms
コンパイル使用メモリ 74,012 KB
実行使用メモリ 50,084 KB
最終ジャッジ日時 2023-09-08 19:42:31
合計ジャッジ時間 4,857 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,444 KB
testcase_01 AC 43 ms
49,416 KB
testcase_02 AC 49 ms
49,572 KB
testcase_03 AC 42 ms
49,304 KB
testcase_04 AC 42 ms
49,292 KB
testcase_05 AC 156 ms
49,828 KB
testcase_06 AC 42 ms
49,384 KB
testcase_07 AC 42 ms
49,400 KB
testcase_08 AC 42 ms
49,368 KB
testcase_09 AC 46 ms
49,468 KB
testcase_10 AC 44 ms
49,260 KB
testcase_11 AC 45 ms
49,316 KB
testcase_12 AC 44 ms
49,240 KB
testcase_13 AC 71 ms
49,792 KB
testcase_14 AC 43 ms
49,320 KB
testcase_15 AC 42 ms
49,400 KB
testcase_16 AC 42 ms
49,256 KB
testcase_17 AC 42 ms
49,340 KB
testcase_18 AC 156 ms
50,084 KB
testcase_19 AC 88 ms
49,752 KB
testcase_20 AC 83 ms
49,780 KB
testcase_21 AC 131 ms
49,756 KB
testcase_22 AC 139 ms
49,876 KB
testcase_23 AC 139 ms
47,836 KB
testcase_24 AC 52 ms
49,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        System.out.println(fact(2 * n) * pow(pow(2, n), MOD - 2) % MOD);
    }
    
    static long pow(long x, int p) {
        if (p == 0) {
            return 1;
        } else if (p % 2 == 0) {
            return pow(x * x % MOD, p / 2);
        } else {
            return pow(x, p - 1) * x % MOD;
        }
    }
    
    static long fact(int x) {
        long ans = 1;
        for (int i = 1; i <= x; i++) {
            ans *= i;
            ans %= MOD;
        }
        return ans;
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0