結果

問題 No.523 LED
ユーザー tentententen
提出日時 2022-08-10 16:55:39
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 1,390 bytes
コンパイル時間 4,328 ms
コンパイル使用メモリ 77,480 KB
実行使用メモリ 830,128 KB
最終ジャッジ日時 2024-09-21 03:39:52
合計ジャッジ時間 6,303 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 MLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

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(proc(n * 2) * pow(pow(2, n), MOD - 2) % MOD);
    }
    
    static long proc(int x) {
        if (x == 0) {
            return 1;
        } else {
            return proc(x - 1) * x % 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;
        }
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    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