結果

問題 No.420 mod2漸化式
ユーザー tentententen
提出日時 2020-10-14 11:22:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 1,000 ms
コード長 804 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 73,748 KB
実行使用メモリ 57,064 KB
最終ジャッジ日時 2023-09-28 00:31:56
合計ジャッジ時間 8,333 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
56,700 KB
testcase_01 AC 130 ms
56,656 KB
testcase_02 AC 129 ms
56,796 KB
testcase_03 AC 142 ms
56,808 KB
testcase_04 AC 130 ms
56,804 KB
testcase_05 AC 134 ms
56,812 KB
testcase_06 AC 109 ms
55,988 KB
testcase_07 AC 127 ms
56,780 KB
testcase_08 AC 129 ms
54,856 KB
testcase_09 AC 127 ms
56,768 KB
testcase_10 AC 131 ms
57,064 KB
testcase_11 AC 129 ms
56,808 KB
testcase_12 AC 129 ms
56,340 KB
testcase_13 AC 130 ms
56,960 KB
testcase_14 AC 128 ms
56,908 KB
testcase_15 AC 129 ms
56,768 KB
testcase_16 AC 129 ms
56,808 KB
testcase_17 AC 128 ms
56,440 KB
testcase_18 AC 130 ms
56,824 KB
testcase_19 AC 139 ms
56,500 KB
testcase_20 AC 132 ms
56,588 KB
testcase_21 AC 127 ms
56,612 KB
testcase_22 AC 135 ms
56,760 KB
testcase_23 AC 132 ms
56,768 KB
testcase_24 AC 130 ms
56,604 KB
testcase_25 AC 134 ms
56,684 KB
testcase_26 AC 132 ms
56,704 KB
testcase_27 AC 126 ms
56,776 KB
testcase_28 AC 129 ms
56,828 KB
testcase_29 AC 130 ms
57,008 KB
testcase_30 AC 131 ms
56,772 KB
testcase_31 AC 134 ms
56,676 KB
testcase_32 AC 135 ms
57,000 KB
testcase_33 AC 111 ms
56,104 KB
testcase_34 AC 113 ms
55,984 KB
testcase_35 AC 114 ms
56,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int x = sc.nextInt();
    	if (x > 31) {
    	    System.out.println("0 0");
    	    return;
    	}
    	if (x == 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];
    	        }
    	    }
    	}
    	long count = comb[31][x];
    	long sum = 0;
    	for (int i = 0; i < 31; i++) {
    	    sum += (1L << i) * comb[30][x - 1];
    	}
    	System.out.println(count + " " + sum);
	}
}
0