結果

問題 No.420 mod2漸化式
ユーザー hermione17hermione17
提出日時 2016-09-09 22:47:06
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 3,745 ms
コンパイル使用メモリ 76,376 KB
実行使用メモリ 55,060 KB
最終ジャッジ日時 2024-04-28 02:23:54
合計ジャッジ時間 10,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
42,252 KB
testcase_01 AC 162 ms
42,596 KB
testcase_02 AC 158 ms
42,440 KB
testcase_03 AC 161 ms
42,308 KB
testcase_04 AC 159 ms
42,312 KB
testcase_05 AC 160 ms
42,424 KB
testcase_06 WA -
testcase_07 AC 165 ms
42,548 KB
testcase_08 AC 160 ms
42,400 KB
testcase_09 AC 155 ms
42,376 KB
testcase_10 AC 153 ms
42,508 KB
testcase_11 AC 156 ms
42,604 KB
testcase_12 AC 163 ms
42,404 KB
testcase_13 AC 154 ms
42,236 KB
testcase_14 AC 155 ms
42,608 KB
testcase_15 AC 161 ms
42,456 KB
testcase_16 AC 163 ms
42,436 KB
testcase_17 AC 162 ms
42,508 KB
testcase_18 AC 141 ms
41,944 KB
testcase_19 AC 153 ms
42,604 KB
testcase_20 AC 156 ms
42,328 KB
testcase_21 AC 153 ms
42,596 KB
testcase_22 AC 146 ms
42,108 KB
testcase_23 AC 157 ms
42,672 KB
testcase_24 AC 158 ms
42,544 KB
testcase_25 AC 157 ms
42,464 KB
testcase_26 AC 157 ms
42,296 KB
testcase_27 AC 152 ms
42,560 KB
testcase_28 AC 144 ms
41,940 KB
testcase_29 AC 153 ms
42,232 KB
testcase_30 AC 158 ms
42,592 KB
testcase_31 AC 142 ms
42,204 KB
testcase_32 AC 158 ms
42,292 KB
testcase_33 AC 138 ms
41,816 KB
testcase_34 AC 140 ms
42,268 KB
testcase_35 AC 153 ms
42,392 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;
			}
		}
		
		System.out.println("" + ansCnt + " " + ansSum);
	}
	public static void main(String argv[]) {
		new Y420();
	}
}
0