結果

問題 No.129 お年玉(2)
ユーザー GrenacheGrenache
提出日時 2015-12-28 23:56:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 356 ms / 5,000 ms
コード長 673 bytes
コンパイル時間 5,115 ms
コンパイル使用メモリ 72,988 KB
実行使用メモリ 56,564 KB
最終ジャッジ日時 2023-08-18 17:30:56
合計ジャッジ時間 16,342 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,496 KB
testcase_01 AC 322 ms
56,388 KB
testcase_02 AC 106 ms
55,840 KB
testcase_03 AC 110 ms
55,844 KB
testcase_04 AC 108 ms
55,800 KB
testcase_05 AC 196 ms
55,984 KB
testcase_06 AC 249 ms
56,372 KB
testcase_07 AC 275 ms
56,240 KB
testcase_08 AC 224 ms
55,840 KB
testcase_09 AC 266 ms
56,408 KB
testcase_10 AC 280 ms
55,592 KB
testcase_11 AC 226 ms
55,764 KB
testcase_12 AC 255 ms
55,788 KB
testcase_13 AC 264 ms
55,812 KB
testcase_14 AC 256 ms
55,924 KB
testcase_15 AC 234 ms
55,908 KB
testcase_16 AC 262 ms
56,180 KB
testcase_17 AC 280 ms
55,784 KB
testcase_18 AC 273 ms
54,140 KB
testcase_19 AC 276 ms
56,080 KB
testcase_20 AC 290 ms
55,912 KB
testcase_21 AC 356 ms
55,960 KB
testcase_22 AC 226 ms
55,972 KB
testcase_23 AC 289 ms
56,196 KB
testcase_24 AC 280 ms
54,752 KB
testcase_25 AC 220 ms
55,680 KB
testcase_26 AC 226 ms
56,224 KB
testcase_27 AC 222 ms
56,164 KB
testcase_28 AC 315 ms
56,564 KB
testcase_29 AC 107 ms
56,288 KB
testcase_30 AC 105 ms
56,080 KB
testcase_31 AC 106 ms
56,084 KB
testcase_32 AC 107 ms
55,716 KB
testcase_33 AC 117 ms
56,176 KB
testcase_34 AC 115 ms
56,344 KB
testcase_35 AC 119 ms
55,548 KB
testcase_36 AC 119 ms
56,072 KB
testcase_37 AC 129 ms
55,964 KB
testcase_38 AC 138 ms
56,168 KB
testcase_39 AC 152 ms
56,192 KB
testcase_40 AC 215 ms
56,380 KB
testcase_41 AC 173 ms
56,372 KB
testcase_42 AC 139 ms
56,016 KB
testcase_43 AC 143 ms
55,872 KB
testcase_44 AC 312 ms
56,240 KB
testcase_45 AC 127 ms
56,076 KB
testcase_46 AC 154 ms
55,972 KB
testcase_47 AC 305 ms
56,164 KB
testcase_48 AC 239 ms
56,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder129 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int MOD = 1_000_000_000;

        long n = sc.nextLong() / 1000;
        int m = sc.nextInt();

        int a = (int)(n % m);

        int[][] p = new int[2][m + 1];
        for (int i = 0; i <= m; i++) {
        	for (int j = 0; j <= i; j++) {
        		if (j == 0 || j == i) {
        			p[i % 2][j] = 1;
        		} else {
        			p[i % 2][j] = (p[(i + 1) % 2][j - 1] + p[(i + 1) % 2][j]) % MOD;
        		}
        	}
        }

        System.out.println(p[m % 2][a]);

        sc.close();
    }
}
0