結果

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

ソースコード

diff #

package No400番台;

import java.util.Scanner;

public class Q420 {
	public static void main(String[] args) {
		new Q420().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		if (x >= 32) {
			System.out.println(0 + " " + 0);
		} else {
			long comb = 1;
			for (int i = 31; i >= Math.max(31 - x, x) + 1; i--) {
				comb *= i;
			}
			for (int i = Math.min(31 - x, x); i >= 1; i--) {
				comb /= i;
			}
			long sum = (1L << 31) - 1;
			sum *= comb * x / 31;
			System.out.println(comb + " " + sum);
		}
	}
}
0