結果

問題 No.129 お年玉(2)
ユーザー ぴろずぴろず
提出日時 2015-01-16 23:30:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 646 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 4,038 ms
コンパイル使用メモリ 72,388 KB
実行使用メモリ 59,196 KB
最終ジャッジ日時 2023-08-18 16:25:12
合計ジャッジ時間 24,226 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
58,376 KB
testcase_01 AC 630 ms
58,952 KB
testcase_02 AC 114 ms
55,836 KB
testcase_03 AC 114 ms
56,048 KB
testcase_04 AC 113 ms
56,608 KB
testcase_05 AC 410 ms
58,924 KB
testcase_06 AC 499 ms
58,996 KB
testcase_07 AC 569 ms
58,960 KB
testcase_08 AC 461 ms
58,732 KB
testcase_09 AC 527 ms
58,924 KB
testcase_10 AC 593 ms
58,832 KB
testcase_11 AC 467 ms
59,088 KB
testcase_12 AC 497 ms
58,648 KB
testcase_13 AC 521 ms
58,708 KB
testcase_14 AC 520 ms
58,892 KB
testcase_15 AC 475 ms
58,804 KB
testcase_16 AC 516 ms
58,816 KB
testcase_17 AC 585 ms
58,968 KB
testcase_18 AC 556 ms
58,836 KB
testcase_19 AC 576 ms
58,896 KB
testcase_20 AC 571 ms
59,092 KB
testcase_21 AC 609 ms
58,724 KB
testcase_22 AC 459 ms
58,708 KB
testcase_23 AC 579 ms
59,020 KB
testcase_24 AC 560 ms
59,196 KB
testcase_25 AC 447 ms
59,048 KB
testcase_26 AC 464 ms
59,084 KB
testcase_27 AC 447 ms
58,820 KB
testcase_28 AC 646 ms
58,964 KB
testcase_29 AC 113 ms
55,564 KB
testcase_30 AC 107 ms
55,896 KB
testcase_31 AC 109 ms
55,672 KB
testcase_32 AC 109 ms
55,668 KB
testcase_33 AC 134 ms
58,244 KB
testcase_34 AC 118 ms
55,684 KB
testcase_35 AC 147 ms
56,156 KB
testcase_36 AC 152 ms
58,128 KB
testcase_37 AC 156 ms
58,356 KB
testcase_38 AC 220 ms
58,520 KB
testcase_39 AC 236 ms
58,840 KB
testcase_40 AC 426 ms
58,764 KB
testcase_41 AC 359 ms
58,716 KB
testcase_42 AC 217 ms
58,916 KB
testcase_43 AC 210 ms
58,728 KB
testcase_44 AC 630 ms
58,896 KB
testcase_45 AC 192 ms
58,868 KB
testcase_46 AC 234 ms
58,372 KB
testcase_47 AC 646 ms
58,984 KB
testcase_48 AC 491 ms
59,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no129;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	static final BigInteger MOD = new BigInteger("1000000000");
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long m = sc.nextInt();
		long k = (n - (n / m / 1000 * 1000) * m) / 1000;
		//m C k
		//System.out.println(m + "," + k);
		BigInteger ans = BigInteger.ONE;
		for(int i=1;i<=m;i++) {
			ans = ans.multiply(BigInteger.valueOf(i));
		}
		for(int i=1;i<=m-k;i++) {
			ans = ans.divide(BigInteger.valueOf(i));
		}
		for(int i=1;i<=k;i++) {
			ans = ans.divide(BigInteger.valueOf(i));
		}
		ans = ans.mod(MOD);
		System.out.println(ans);
	}

}
0