結果

問題 No.420 mod2漸化式
ユーザー YamaKasaYamaKasa
提出日時 2018-09-20 01:54:42
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 535 bytes
コンパイル時間 2,261 ms
コンパイル使用メモリ 73,936 KB
実行使用メモリ 838,396 KB
最終ジャッジ日時 2023-09-25 10:22:49
合計ジャッジ時間 7,569 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
58,712 KB
testcase_01 TLE -
testcase_02 AC 150 ms
56,760 KB
testcase_03 AC 149 ms
56,616 KB
testcase_04 AC 150 ms
56,836 KB
testcase_05 AC 154 ms
56,688 KB
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long x = scan.nextLong();
		scan.close();
		if(x > 31) {
			System.out.println(0 + " " + 0);
		}else {
			long c = comb(31, (int)x);
			long sum = ((long)Math.pow(2, 31) - 1) * comb(30, (int)x-1);
			System.out.println(c + " " + sum);
		}
	}
	static long comb(int n, int k) {
		if(k == 0) {
			return 1;
		}else if(n == k) {
			return 1;
		}else {
			return comb(n - 1, k - 1) + comb(n - 1, k);
		}
	}
}
0