結果

問題 No.420 mod2漸化式
ユーザー tentententen
提出日時 2023-04-14 13:32:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,093 bytes
コンパイル時間 2,493 ms
コンパイル使用メモリ 90,976 KB
実行使用メモリ 50,572 KB
最終ジャッジ日時 2024-04-18 12:22:32
合計ジャッジ時間 5,409 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,080 KB
testcase_01 AC 53 ms
36,896 KB
testcase_02 AC 51 ms
37,208 KB
testcase_03 AC 53 ms
36,992 KB
testcase_04 AC 52 ms
37,172 KB
testcase_05 AC 51 ms
37,156 KB
testcase_06 AC 52 ms
36,984 KB
testcase_07 AC 53 ms
37,032 KB
testcase_08 AC 52 ms
37,172 KB
testcase_09 AC 52 ms
37,240 KB
testcase_10 AC 52 ms
37,164 KB
testcase_11 AC 52 ms
37,028 KB
testcase_12 AC 51 ms
37,132 KB
testcase_13 AC 53 ms
37,032 KB
testcase_14 AC 51 ms
37,104 KB
testcase_15 AC 52 ms
36,984 KB
testcase_16 AC 52 ms
37,240 KB
testcase_17 AC 52 ms
36,748 KB
testcase_18 AC 52 ms
36,784 KB
testcase_19 AC 53 ms
36,992 KB
testcase_20 AC 52 ms
37,216 KB
testcase_21 AC 51 ms
36,764 KB
testcase_22 AC 54 ms
37,060 KB
testcase_23 AC 53 ms
37,136 KB
testcase_24 AC 52 ms
37,080 KB
testcase_25 AC 53 ms
37,048 KB
testcase_26 AC 53 ms
36,952 KB
testcase_27 AC 56 ms
37,268 KB
testcase_28 AC 53 ms
37,164 KB
testcase_29 AC 52 ms
37,184 KB
testcase_30 AC 54 ms
37,212 KB
testcase_31 AC 51 ms
37,164 KB
testcase_32 AC 52 ms
36,988 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        if (n > 31) {
            System.out.println(0);
            return;
        }
        if (n == 0) {
            System.out.println("1 0");
            return;
        }
        long[][] comb = new long[32][32];
        for (int i = 0; i < 32; i++) {
            for (int j = 0; j <= i; j++) {
                if (j == 0 || j == i) {
                    comb[i][j] = 1;
                } else {
                    comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
                }
            }
        }
        System.out.print(comb[31][n]);
        System.out.print(" ");
        System.out.println(((1L << 31) - 1) * comb[30][n - 1]);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
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 int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0