結果

問題 No.129 お年玉(2)
ユーザー kenkooookenkoooo
提出日時 2015-04-20 21:56:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 818 ms / 5,000 ms
コード長 711 bytes
コンパイル時間 2,417 ms
コンパイル使用メモリ 73,484 KB
実行使用メモリ 458,968 KB
最終ジャッジ日時 2023-08-18 17:10:09
合計ジャッジ時間 26,435 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
78,660 KB
testcase_01 AC 815 ms
439,236 KB
testcase_02 AC 115 ms
52,516 KB
testcase_03 AC 110 ms
55,684 KB
testcase_04 AC 115 ms
55,968 KB
testcase_05 AC 430 ms
231,188 KB
testcase_06 AC 583 ms
359,704 KB
testcase_07 AC 739 ms
457,872 KB
testcase_08 AC 525 ms
268,060 KB
testcase_09 AC 605 ms
360,440 KB
testcase_10 AC 726 ms
454,784 KB
testcase_11 AC 478 ms
258,524 KB
testcase_12 AC 679 ms
358,864 KB
testcase_13 AC 606 ms
356,764 KB
testcase_14 AC 594 ms
357,196 KB
testcase_15 AC 544 ms
358,676 KB
testcase_16 AC 583 ms
361,784 KB
testcase_17 AC 716 ms
458,708 KB
testcase_18 AC 628 ms
358,680 KB
testcase_19 AC 723 ms
458,948 KB
testcase_20 AC 710 ms
457,912 KB
testcase_21 AC 813 ms
457,700 KB
testcase_22 AC 512 ms
271,832 KB
testcase_23 AC 742 ms
453,420 KB
testcase_24 AC 722 ms
458,968 KB
testcase_25 AC 476 ms
260,900 KB
testcase_26 AC 483 ms
264,272 KB
testcase_27 AC 481 ms
260,248 KB
testcase_28 AC 803 ms
457,780 KB
testcase_29 AC 108 ms
55,804 KB
testcase_30 AC 107 ms
54,340 KB
testcase_31 AC 109 ms
56,700 KB
testcase_32 AC 108 ms
56,284 KB
testcase_33 AC 108 ms
55,948 KB
testcase_34 AC 120 ms
56,160 KB
testcase_35 AC 126 ms
58,196 KB
testcase_36 AC 131 ms
57,940 KB
testcase_37 AC 128 ms
59,864 KB
testcase_38 AC 206 ms
115,192 KB
testcase_39 AC 259 ms
132,340 KB
testcase_40 AC 472 ms
243,836 KB
testcase_41 AC 329 ms
189,764 KB
testcase_42 AC 217 ms
115,064 KB
testcase_43 AC 216 ms
115,204 KB
testcase_44 AC 818 ms
454,172 KB
testcase_45 AC 174 ms
87,468 KB
testcase_46 AC 270 ms
131,972 KB
testcase_47 AC 795 ms
455,620 KB
testcase_48 AC 549 ms
357,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
		}
	}
}
0