結果

問題 No.420 mod2漸化式
ユーザー htensaihtensai
提出日時 2019-11-20 00:53:25
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 787 bytes
コンパイル時間 2,213 ms
コンパイル使用メモリ 79,768 KB
実行使用メモリ 55,196 KB
最終ジャッジ日時 2024-04-15 04:55:53
合計ジャッジ時間 8,738 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 151 ms
54,984 KB
testcase_01 AC 152 ms
55,040 KB
testcase_02 AC 152 ms
54,952 KB
testcase_03 AC 151 ms
55,052 KB
testcase_04 AC 153 ms
54,936 KB
testcase_05 AC 139 ms
54,684 KB
testcase_06 RE -
testcase_07 AC 160 ms
55,068 KB
testcase_08 AC 154 ms
55,064 KB
testcase_09 AC 154 ms
54,936 KB
testcase_10 AC 152 ms
55,092 KB
testcase_11 AC 152 ms
55,004 KB
testcase_12 AC 154 ms
54,864 KB
testcase_13 AC 151 ms
54,996 KB
testcase_14 AC 153 ms
54,976 KB
testcase_15 AC 150 ms
54,840 KB
testcase_16 AC 154 ms
55,040 KB
testcase_17 AC 153 ms
54,948 KB
testcase_18 AC 152 ms
55,156 KB
testcase_19 AC 161 ms
54,676 KB
testcase_20 AC 154 ms
54,644 KB
testcase_21 AC 137 ms
54,736 KB
testcase_22 AC 151 ms
54,916 KB
testcase_23 AC 151 ms
54,876 KB
testcase_24 AC 159 ms
54,788 KB
testcase_25 AC 151 ms
54,984 KB
testcase_26 AC 160 ms
55,060 KB
testcase_27 AC 152 ms
55,196 KB
testcase_28 AC 152 ms
54,940 KB
testcase_29 AC 152 ms
55,060 KB
testcase_30 AC 142 ms
54,728 KB
testcase_31 AC 153 ms
54,960 KB
testcase_32 AC 158 ms
54,888 KB
testcase_33 AC 131 ms
54,084 KB
testcase_34 AC 130 ms
54,136 KB
testcase_35 AC 130 ms
53,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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