結果

問題 No.420 mod2漸化式
ユーザー hermione17
提出日時 2016-09-09 22:47:06
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 5,277 ms
コンパイル使用メモリ 75,792 KB
実行使用メモリ 42,480 KB
最終ジャッジ日時 2024-11-16 10:38:30
合計ジャッジ時間 10,667 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 34 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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