結果

問題 No.129 お年玉(2)
ユーザー tentententen
提出日時 2020-12-04 16:59:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 649 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 2,483 ms
コンパイル使用メモリ 72,384 KB
実行使用メモリ 458,788 KB
最終ジャッジ日時 2023-10-13 06:19:04
合計ジャッジ時間 22,654 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
79,756 KB
testcase_01 AC 646 ms
453,332 KB
testcase_02 AC 118 ms
55,560 KB
testcase_03 AC 118 ms
56,064 KB
testcase_04 AC 120 ms
56,204 KB
testcase_05 AC 367 ms
230,716 KB
testcase_06 AC 471 ms
355,732 KB
testcase_07 AC 599 ms
457,596 KB
testcase_08 AC 413 ms
265,364 KB
testcase_09 AC 501 ms
358,928 KB
testcase_10 AC 592 ms
454,148 KB
testcase_11 AC 405 ms
256,728 KB
testcase_12 AC 480 ms
357,152 KB
testcase_13 AC 487 ms
354,576 KB
testcase_14 AC 483 ms
353,816 KB
testcase_15 AC 450 ms
355,244 KB
testcase_16 AC 475 ms
358,692 KB
testcase_17 AC 590 ms
458,376 KB
testcase_18 AC 494 ms
357,356 KB
testcase_19 AC 586 ms
458,204 KB
testcase_20 AC 581 ms
457,984 KB
testcase_21 AC 639 ms
457,688 KB
testcase_22 AC 411 ms
272,436 KB
testcase_23 AC 603 ms
453,196 KB
testcase_24 AC 599 ms
458,788 KB
testcase_25 AC 404 ms
260,712 KB
testcase_26 AC 409 ms
264,544 KB
testcase_27 AC 405 ms
259,596 KB
testcase_28 AC 649 ms
457,428 KB
testcase_29 AC 120 ms
55,968 KB
testcase_30 AC 120 ms
56,032 KB
testcase_31 AC 119 ms
56,124 KB
testcase_32 AC 120 ms
55,704 KB
testcase_33 AC 127 ms
58,196 KB
testcase_34 AC 124 ms
55,644 KB
testcase_35 AC 129 ms
58,132 KB
testcase_36 AC 132 ms
58,168 KB
testcase_37 AC 134 ms
60,428 KB
testcase_38 AC 194 ms
114,684 KB
testcase_39 AC 231 ms
132,188 KB
testcase_40 AC 392 ms
243,660 KB
testcase_41 AC 282 ms
188,576 KB
testcase_42 AC 201 ms
114,704 KB
testcase_43 AC 198 ms
115,168 KB
testcase_44 AC 642 ms
454,348 KB
testcase_45 AC 173 ms
86,968 KB
testcase_46 AC 232 ms
131,260 KB
testcase_47 AC 635 ms
455,736 KB
testcase_48 AC 448 ms
357,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong() / 1000;
        int m = sc.nextInt();
        int[][] comb = new int[m + 1][m + 1];
        for (int i = 0; i <= m; i++) {
            for (int j = 0; j <= i; j++) {
                if (j == 0 || j == i) {
                    comb[i][j] = 1;
                } else {
                    comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
                }
            }
        }
        System.out.println(comb[m][(int)(n % m)]);
    }
}
0