結果

問題 No.420 mod2漸化式
ユーザー 37zigen37zigen
提出日時 2016-09-10 01:28:40
言語 Java19
(openjdk 21)
結果
AC  
実行時間 161 ms / 1,000 ms
コード長 764 bytes
コンパイル時間 6,015 ms
コンパイル使用メモリ 78,504 KB
実行使用メモリ 59,096 KB
最終ジャッジ日時 2023-08-25 23:29:26
合計ジャッジ時間 11,063 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
57,060 KB
testcase_01 AC 156 ms
57,072 KB
testcase_02 AC 156 ms
56,832 KB
testcase_03 AC 157 ms
56,836 KB
testcase_04 AC 157 ms
57,004 KB
testcase_05 AC 154 ms
56,876 KB
testcase_06 AC 161 ms
56,780 KB
testcase_07 AC 159 ms
57,044 KB
testcase_08 AC 161 ms
56,680 KB
testcase_09 AC 160 ms
59,096 KB
testcase_10 AC 161 ms
56,992 KB
testcase_11 AC 160 ms
56,972 KB
testcase_12 AC 156 ms
56,728 KB
testcase_13 AC 157 ms
57,052 KB
testcase_14 AC 156 ms
57,180 KB
testcase_15 AC 157 ms
56,724 KB
testcase_16 AC 157 ms
57,004 KB
testcase_17 AC 157 ms
56,956 KB
testcase_18 AC 156 ms
56,876 KB
testcase_19 AC 156 ms
57,052 KB
testcase_20 AC 157 ms
56,944 KB
testcase_21 AC 156 ms
56,880 KB
testcase_22 AC 159 ms
56,932 KB
testcase_23 AC 156 ms
57,088 KB
testcase_24 AC 158 ms
56,928 KB
testcase_25 AC 156 ms
54,936 KB
testcase_26 AC 159 ms
56,900 KB
testcase_27 AC 159 ms
57,092 KB
testcase_28 AC 157 ms
56,912 KB
testcase_29 AC 158 ms
56,864 KB
testcase_30 AC 158 ms
57,008 KB
testcase_31 AC 159 ms
56,964 KB
testcase_32 AC 159 ms
57,372 KB
testcase_33 AC 126 ms
55,864 KB
testcase_34 AC 125 ms
55,768 KB
testcase_35 AC 123 ms
57,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package No400番台;

import java.math.BigInteger;
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 {
			BigInteger comb = new BigInteger("1");
			for (int i = 31; i >= Math.max(31 - x, x) + 1; i--) {
				comb = comb.multiply(BigInteger.valueOf(i));
			}
			for (int i = Math.min(31 - x, x); i >= 1; i--) {
				comb = comb.divide(BigInteger.valueOf(i));
			}
			BigInteger sum = BigInteger.valueOf((1L << 31) - 1);
			sum=sum.multiply(comb.multiply(BigInteger.valueOf(x)).divide(BigInteger.valueOf(31)));
			System.out.println(comb + " " + sum);
		}
	}
}
0