結果

問題 No.129 お年玉(2)
ユーザー ぴろずぴろず
提出日時 2015-01-16 23:30:14
言語 Java19
(openjdk 19.0.1)
結果
AC  
実行時間 667 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 2,534 ms
実行使用メモリ 43,840 KB
最終ジャッジ日時 2023-01-04 19:11:12
合計ジャッジ時間 22,944 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 186 ms
42,984 KB
testcase_01 AC 630 ms
43,528 KB
testcase_02 AC 92 ms
37,440 KB
testcase_03 AC 96 ms
37,444 KB
testcase_04 AC 100 ms
37,524 KB
testcase_05 AC 374 ms
43,560 KB
testcase_06 AC 493 ms
43,840 KB
testcase_07 AC 575 ms
43,672 KB
testcase_08 AC 447 ms
43,424 KB
testcase_09 AC 531 ms
43,580 KB
testcase_10 AC 584 ms
43,664 KB
testcase_11 AC 438 ms
43,612 KB
testcase_12 AC 503 ms
43,680 KB
testcase_13 AC 499 ms
43,600 KB
testcase_14 AC 505 ms
43,420 KB
testcase_15 AC 457 ms
43,676 KB
testcase_16 AC 500 ms
43,648 KB
testcase_17 AC 532 ms
43,652 KB
testcase_18 AC 553 ms
43,592 KB
testcase_19 AC 556 ms
43,600 KB
testcase_20 AC 552 ms
43,624 KB
testcase_21 AC 647 ms
43,624 KB
testcase_22 AC 446 ms
43,712 KB
testcase_23 AC 598 ms
43,660 KB
testcase_24 AC 571 ms
43,600 KB
testcase_25 AC 439 ms
43,540 KB
testcase_26 AC 452 ms
43,536 KB
testcase_27 AC 426 ms
43,684 KB
testcase_28 AC 647 ms
43,512 KB
testcase_29 AC 95 ms
37,668 KB
testcase_30 AC 93 ms
37,460 KB
testcase_31 AC 102 ms
37,724 KB
testcase_32 AC 99 ms
37,660 KB
testcase_33 AC 117 ms
38,720 KB
testcase_34 AC 110 ms
37,992 KB
testcase_35 AC 111 ms
38,688 KB
testcase_36 AC 113 ms
39,096 KB
testcase_37 AC 125 ms
39,892 KB
testcase_38 AC 205 ms
42,844 KB
testcase_39 AC 225 ms
42,880 KB
testcase_40 AC 400 ms
43,452 KB
testcase_41 AC 334 ms
43,500 KB
testcase_42 AC 203 ms
42,848 KB
testcase_43 AC 204 ms
42,860 KB
testcase_44 AC 667 ms
43,688 KB
testcase_45 AC 183 ms
42,900 KB
testcase_46 AC 229 ms
42,776 KB
testcase_47 AC 657 ms
43,640 KB
testcase_48 AC 461 ms
43,732 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