結果

問題 No.129 お年玉(2)
ユーザー htensai
提出日時 2019-12-12 18:55:11
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 679 bytes
コンパイル時間 2,662 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 745,716 KB
最終ジャッジ日時 2024-06-25 12:34:26
合計ジャッジ時間 29,118 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 MLE * 19
権限があれば一括ダウンロードができます

ソースコード

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();
        long[][] comb = new long[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