結果

問題 No.420 mod2漸化式
ユーザー 37zigen37zigen
提出日時 2016-09-10 01:28:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 1,000 ms
コード長 764 bytes
コンパイル時間 3,264 ms
コンパイル使用メモリ 77,924 KB
実行使用メモリ 57,400 KB
最終ジャッジ日時 2023-08-25 23:27:50
合計ジャッジ時間 10,153 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
57,004 KB
testcase_01 AC 149 ms
54,972 KB
testcase_02 AC 149 ms
57,320 KB
testcase_03 AC 149 ms
57,068 KB
testcase_04 AC 150 ms
56,808 KB
testcase_05 AC 150 ms
56,872 KB
testcase_06 AC 150 ms
56,892 KB
testcase_07 AC 150 ms
57,320 KB
testcase_08 AC 149 ms
56,720 KB
testcase_09 AC 150 ms
57,080 KB
testcase_10 AC 151 ms
57,060 KB
testcase_11 AC 153 ms
57,376 KB
testcase_12 AC 149 ms
57,044 KB
testcase_13 AC 149 ms
57,064 KB
testcase_14 AC 151 ms
56,712 KB
testcase_15 AC 151 ms
57,084 KB
testcase_16 AC 150 ms
56,992 KB
testcase_17 AC 152 ms
56,992 KB
testcase_18 AC 152 ms
57,220 KB
testcase_19 AC 152 ms
57,400 KB
testcase_20 AC 157 ms
56,976 KB
testcase_21 AC 154 ms
55,084 KB
testcase_22 AC 154 ms
56,948 KB
testcase_23 AC 152 ms
57,048 KB
testcase_24 AC 150 ms
57,100 KB
testcase_25 AC 153 ms
56,732 KB
testcase_26 AC 153 ms
56,908 KB
testcase_27 AC 151 ms
57,088 KB
testcase_28 AC 152 ms
56,792 KB
testcase_29 AC 151 ms
56,996 KB
testcase_30 AC 150 ms
57,308 KB
testcase_31 AC 151 ms
56,872 KB
testcase_32 AC 150 ms
57,060 KB
testcase_33 AC 121 ms
55,868 KB
testcase_34 AC 119 ms
55,512 KB
testcase_35 AC 119 ms
55,784 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