結果

問題 No.420 mod2漸化式
ユーザー tentententen
提出日時 2023-02-15 11:59:34
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 2,014 bytes
コンパイル時間 2,662 ms
コンパイル使用メモリ 89,748 KB
実行使用メモリ 52,832 KB
最終ジャッジ日時 2023-09-24 21:36:15
合計ジャッジ時間 7,586 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
52,676 KB
testcase_01 AC 82 ms
52,324 KB
testcase_02 AC 83 ms
52,308 KB
testcase_03 AC 83 ms
52,728 KB
testcase_04 AC 81 ms
52,400 KB
testcase_05 AC 92 ms
52,380 KB
testcase_06 RE -
testcase_07 AC 84 ms
52,544 KB
testcase_08 AC 84 ms
52,496 KB
testcase_09 AC 83 ms
52,740 KB
testcase_10 AC 79 ms
52,372 KB
testcase_11 AC 82 ms
52,392 KB
testcase_12 AC 83 ms
52,448 KB
testcase_13 AC 81 ms
52,312 KB
testcase_14 AC 90 ms
50,480 KB
testcase_15 AC 91 ms
52,576 KB
testcase_16 AC 80 ms
52,384 KB
testcase_17 AC 82 ms
52,600 KB
testcase_18 AC 81 ms
52,428 KB
testcase_19 AC 90 ms
52,492 KB
testcase_20 AC 81 ms
52,832 KB
testcase_21 AC 80 ms
52,516 KB
testcase_22 AC 80 ms
52,688 KB
testcase_23 AC 81 ms
52,444 KB
testcase_24 AC 91 ms
52,540 KB
testcase_25 AC 80 ms
52,440 KB
testcase_26 AC 78 ms
52,436 KB
testcase_27 AC 80 ms
52,376 KB
testcase_28 AC 80 ms
52,652 KB
testcase_29 AC 80 ms
52,572 KB
testcase_30 AC 82 ms
52,600 KB
testcase_31 AC 91 ms
52,576 KB
testcase_32 AC 80 ms
52,652 KB
testcase_33 AC 45 ms
49,428 KB
testcase_34 AC 45 ms
49,384 KB
testcase_35 AC 47 ms
49,404 KB
権限があれば一括ダウンロードができます

ソースコード

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 + " " + 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];
                }
            }
        }
        long count = comb[31][n];
        long sum = ((1L << 31) - 1) * comb[30][n - 1];
        System.out.println(count + " " + sum);
    }
}
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