結果
問題 |
No.129 お年玉(2)
|
ユーザー |
![]() |
提出日時 | 2015-04-20 21:56:51 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 958 ms / 5,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 1,885 ms |
コンパイル使用メモリ | 77,800 KB |
実行使用メモリ | 456,984 KB |
最終ジャッジ日時 | 2024-11-27 23:48:06 |
合計ジャッジ時間 | 27,522 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); long n = koko.nextLong(); int m = koko.nextInt(); long nama = n % 1000; long nmai = (n - nama) / 1000; long amari = nmai % m; if (amari == 0) { System.out.println(1); } else { int[][] judge = new int[m + 1][m + 1]; for (int i = 0; i < m + 1; i++) { judge[0][i] = 1; judge[i][0] = 1; } for (int i = 1; i < m + 1; i++) { for (int j = 1; j < m + 1; j++) { judge[i][j] = (judge[i - 1][j] + judge[i][j - 1]) % 1000000000; } } long ans = judge[(int) (m - amari)][(int) amari]; System.out.println(ans); } } }