結果

問題 No.129 お年玉(2)
ユーザー tentententen
提出日時 2022-08-10 13:17:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 761 ms / 5,000 ms
コード長 1,362 bytes
コンパイル時間 2,643 ms
コンパイル使用メモリ 77,548 KB
実行使用メモリ 475,680 KB
最終ジャッジ日時 2023-10-20 23:11:45
合計ジャッジ時間 20,529 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
77,756 KB
testcase_01 AC 761 ms
462,384 KB
testcase_02 AC 151 ms
53,448 KB
testcase_03 AC 56 ms
53,440 KB
testcase_04 AC 57 ms
53,432 KB
testcase_05 AC 333 ms
241,024 KB
testcase_06 AC 463 ms
369,924 KB
testcase_07 AC 476 ms
376,404 KB
testcase_08 AC 356 ms
265,340 KB
testcase_09 AC 453 ms
371,692 KB
testcase_10 AC 582 ms
474,248 KB
testcase_11 AC 365 ms
256,828 KB
testcase_12 AC 457 ms
373,040 KB
testcase_13 AC 446 ms
377,112 KB
testcase_14 AC 438 ms
375,876 KB
testcase_15 AC 365 ms
273,064 KB
testcase_16 AC 424 ms
372,080 KB
testcase_17 AC 460 ms
377,856 KB
testcase_18 AC 452 ms
375,532 KB
testcase_19 AC 472 ms
377,964 KB
testcase_20 AC 464 ms
377,900 KB
testcase_21 AC 597 ms
468,092 KB
testcase_22 AC 353 ms
268,304 KB
testcase_23 AC 576 ms
475,680 KB
testcase_24 AC 476 ms
378,012 KB
testcase_25 AC 353 ms
258,328 KB
testcase_26 AC 356 ms
263,224 KB
testcase_27 AC 348 ms
258,532 KB
testcase_28 AC 602 ms
468,888 KB
testcase_29 AC 55 ms
53,428 KB
testcase_30 AC 55 ms
53,428 KB
testcase_31 AC 54 ms
53,428 KB
testcase_32 AC 56 ms
52,336 KB
testcase_33 AC 80 ms
56,052 KB
testcase_34 AC 59 ms
53,444 KB
testcase_35 AC 65 ms
55,484 KB
testcase_36 AC 77 ms
56,136 KB
testcase_37 AC 79 ms
56,124 KB
testcase_38 AC 123 ms
93,788 KB
testcase_39 AC 167 ms
133,004 KB
testcase_40 AC 342 ms
240,544 KB
testcase_41 AC 226 ms
193,964 KB
testcase_42 AC 135 ms
114,396 KB
testcase_43 AC 134 ms
114,296 KB
testcase_44 AC 601 ms
468,412 KB
testcase_45 AC 103 ms
78,024 KB
testcase_46 AC 174 ms
134,944 KB
testcase_47 AC 590 ms
468,112 KB
testcase_48 AC 371 ms
277,248 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("");
    
    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