結果

問題 No.129 お年玉(2)
ユーザー tentententen
提出日時 2022-10-14 08:58:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 587 ms / 5,000 ms
コード長 1,410 bytes
コンパイル時間 3,793 ms
コンパイル使用メモリ 73,768 KB
実行使用メモリ 467,220 KB
最終ジャッジ日時 2023-09-08 19:32:11
合計ジャッジ時間 19,821 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
75,412 KB
testcase_01 AC 587 ms
467,220 KB
testcase_02 AC 43 ms
49,384 KB
testcase_03 AC 44 ms
49,352 KB
testcase_04 AC 42 ms
49,308 KB
testcase_05 AC 286 ms
233,664 KB
testcase_06 AC 390 ms
361,556 KB
testcase_07 AC 508 ms
462,144 KB
testcase_08 AC 329 ms
260,912 KB
testcase_09 AC 418 ms
366,568 KB
testcase_10 AC 524 ms
464,680 KB
testcase_11 AC 322 ms
251,624 KB
testcase_12 AC 402 ms
364,440 KB
testcase_13 AC 419 ms
368,468 KB
testcase_14 AC 404 ms
363,824 KB
testcase_15 AC 338 ms
269,764 KB
testcase_16 AC 396 ms
364,172 KB
testcase_17 AC 447 ms
372,312 KB
testcase_18 AC 423 ms
361,740 KB
testcase_19 AC 438 ms
365,248 KB
testcase_20 AC 439 ms
362,292 KB
testcase_21 AC 572 ms
464,668 KB
testcase_22 AC 334 ms
262,788 KB
testcase_23 AC 532 ms
466,400 KB
testcase_24 AC 530 ms
465,564 KB
testcase_25 AC 329 ms
253,404 KB
testcase_26 AC 330 ms
258,472 KB
testcase_27 AC 325 ms
251,580 KB
testcase_28 AC 573 ms
466,612 KB
testcase_29 AC 42 ms
49,472 KB
testcase_30 AC 42 ms
49,364 KB
testcase_31 AC 43 ms
49,316 KB
testcase_32 AC 41 ms
49,340 KB
testcase_33 AC 55 ms
53,052 KB
testcase_34 AC 47 ms
49,288 KB
testcase_35 AC 55 ms
52,876 KB
testcase_36 AC 56 ms
53,012 KB
testcase_37 AC 57 ms
52,976 KB
testcase_38 AC 107 ms
90,636 KB
testcase_39 AC 152 ms
130,276 KB
testcase_40 AC 313 ms
238,392 KB
testcase_41 AC 205 ms
188,412 KB
testcase_42 AC 119 ms
113,504 KB
testcase_43 AC 118 ms
113,580 KB
testcase_44 AC 581 ms
465,100 KB
testcase_45 AC 89 ms
75,360 KB
testcase_46 AC 159 ms
130,476 KB
testcase_47 AC 562 ms
463,176 KB
testcase_48 AC 338 ms
272,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static final int MOD = 1000000000;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        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)]);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0