結果

問題 No.129 お年玉(2)
ユーザー htensaihtensai
提出日時 2019-12-12 18:56:41
言語 Java19
(openjdk 21)
結果
AC  
実行時間 662 ms / 5,000 ms
コード長 677 bytes
コンパイル時間 2,286 ms
コンパイル使用メモリ 71,484 KB
実行使用メモリ 458,872 KB
最終ジャッジ日時 2023-09-07 18:50:42
合計ジャッジ時間 22,525 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
79,432 KB
testcase_01 AC 662 ms
453,312 KB
testcase_02 AC 124 ms
55,532 KB
testcase_03 AC 125 ms
55,616 KB
testcase_04 AC 125 ms
55,784 KB
testcase_05 AC 381 ms
230,284 KB
testcase_06 AC 482 ms
360,384 KB
testcase_07 AC 602 ms
457,936 KB
testcase_08 AC 421 ms
267,800 KB
testcase_09 AC 514 ms
361,136 KB
testcase_10 AC 612 ms
453,956 KB
testcase_11 AC 416 ms
257,744 KB
testcase_12 AC 499 ms
359,144 KB
testcase_13 AC 503 ms
357,712 KB
testcase_14 AC 498 ms
358,124 KB
testcase_15 AC 465 ms
357,964 KB
testcase_16 AC 484 ms
361,144 KB
testcase_17 AC 597 ms
457,932 KB
testcase_18 AC 507 ms
359,216 KB
testcase_19 AC 602 ms
457,880 KB
testcase_20 AC 596 ms
457,776 KB
testcase_21 AC 658 ms
457,384 KB
testcase_22 AC 419 ms
271,608 KB
testcase_23 AC 630 ms
453,040 KB
testcase_24 AC 615 ms
458,872 KB
testcase_25 AC 415 ms
260,364 KB
testcase_26 AC 421 ms
263,824 KB
testcase_27 AC 410 ms
261,420 KB
testcase_28 AC 654 ms
457,212 KB
testcase_29 AC 125 ms
56,008 KB
testcase_30 AC 124 ms
55,916 KB
testcase_31 AC 123 ms
55,812 KB
testcase_32 AC 122 ms
55,488 KB
testcase_33 AC 133 ms
58,084 KB
testcase_34 AC 128 ms
56,100 KB
testcase_35 AC 130 ms
57,884 KB
testcase_36 AC 131 ms
57,996 KB
testcase_37 AC 135 ms
60,216 KB
testcase_38 AC 199 ms
115,176 KB
testcase_39 AC 234 ms
132,216 KB
testcase_40 AC 395 ms
243,536 KB
testcase_41 AC 292 ms
189,224 KB
testcase_42 AC 206 ms
112,860 KB
testcase_43 AC 203 ms
114,976 KB
testcase_44 AC 659 ms
455,720 KB
testcase_45 AC 180 ms
86,820 KB
testcase_46 AC 247 ms
131,188 KB
testcase_47 AC 649 ms
455,084 KB
testcase_48 AC 457 ms
357,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        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]) % 1000000000;
                }
            }
        }
        int count = (int)((n / 1000) % m);
        System.out.println(comb[m][count]);
    }
}
0