結果
問題 | No.129 お年玉(2) |
ユーザー |
![]() |
提出日時 | 2019-12-12 18:56:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 695 ms / 5,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 2,324 ms |
コンパイル使用メモリ | 74,648 KB |
実行使用メモリ | 466,396 KB |
最終ジャッジ日時 | 2024-06-25 12:36:04 |
合計ジャッジ時間 | 23,014 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
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]);}}