結果

問題 No.420 mod2漸化式
ユーザー hermione17hermione17
提出日時 2016-09-09 22:48:38
言語 Java19
(openjdk 21)
結果
AC  
実行時間 137 ms / 1,000 ms
コード長 645 bytes
コンパイル時間 3,196 ms
コンパイル使用メモリ 73,756 KB
実行使用メモリ 57,336 KB
最終ジャッジ日時 2023-08-25 23:15:45
合計ジャッジ時間 8,820 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
56,916 KB
testcase_01 AC 126 ms
57,032 KB
testcase_02 AC 137 ms
56,588 KB
testcase_03 AC 129 ms
56,668 KB
testcase_04 AC 127 ms
57,092 KB
testcase_05 AC 126 ms
56,772 KB
testcase_06 AC 131 ms
56,916 KB
testcase_07 AC 129 ms
57,336 KB
testcase_08 AC 127 ms
56,904 KB
testcase_09 AC 127 ms
56,848 KB
testcase_10 AC 126 ms
56,544 KB
testcase_11 AC 135 ms
57,084 KB
testcase_12 AC 126 ms
56,492 KB
testcase_13 AC 125 ms
57,256 KB
testcase_14 AC 125 ms
57,076 KB
testcase_15 AC 130 ms
55,116 KB
testcase_16 AC 124 ms
56,924 KB
testcase_17 AC 132 ms
56,884 KB
testcase_18 AC 128 ms
56,476 KB
testcase_19 AC 127 ms
57,088 KB
testcase_20 AC 124 ms
56,956 KB
testcase_21 AC 124 ms
57,000 KB
testcase_22 AC 127 ms
56,984 KB
testcase_23 AC 130 ms
56,700 KB
testcase_24 AC 124 ms
56,948 KB
testcase_25 AC 124 ms
56,640 KB
testcase_26 AC 127 ms
56,568 KB
testcase_27 AC 124 ms
56,680 KB
testcase_28 AC 135 ms
56,636 KB
testcase_29 AC 125 ms
57,260 KB
testcase_30 AC 126 ms
56,968 KB
testcase_31 AC 131 ms
56,852 KB
testcase_32 AC 133 ms
56,860 KB
testcase_33 AC 126 ms
56,592 KB
testcase_34 AC 124 ms
56,660 KB
testcase_35 AC 127 ms
56,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Y420 {
	Y420() {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		long ansCnt = 0, ansSum = 0;
	
		if (1 <= x && x <= 31) {
			long comb = 1;
			ansCnt = 1;
			for (int i = 0; i < x; i++) {
				ansCnt = ansCnt * (31 - i) / (i + 1);
			}
			for (int i = 0; i < x - 1; i++) {
				comb = comb * (30 - i) / (i + 1);
			}
			
			long power = 1;
			for (int i = 0; i < 31; i++) {
				ansSum += comb * power;
				power *= 2;
			}
		} else if (x == 0) {
			ansCnt = 1;
		}
		
		System.out.println("" + ansCnt + " " + ansSum);
	}
	public static void main(String argv[]) {
		new Y420();
	}
}
0