結果

問題 No.129 お年玉(2)
ユーザー yuki2006yuki2006
提出日時 2015-01-16 17:41:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 273 ms / 5,000 ms
コード長 670 bytes
コンパイル時間 3,559 ms
コンパイル使用メモリ 71,620 KB
実行使用メモリ 56,468 KB
最終ジャッジ日時 2023-08-18 16:21:53
合計ジャッジ時間 14,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
55,524 KB
testcase_01 AC 273 ms
55,940 KB
testcase_02 AC 121 ms
55,820 KB
testcase_03 AC 119 ms
55,760 KB
testcase_04 AC 118 ms
56,124 KB
testcase_05 AC 188 ms
55,812 KB
testcase_06 AC 224 ms
55,720 KB
testcase_07 AC 244 ms
55,504 KB
testcase_08 AC 208 ms
55,740 KB
testcase_09 AC 235 ms
55,828 KB
testcase_10 AC 249 ms
56,036 KB
testcase_11 AC 203 ms
55,696 KB
testcase_12 AC 228 ms
55,876 KB
testcase_13 AC 232 ms
55,968 KB
testcase_14 AC 227 ms
55,508 KB
testcase_15 AC 209 ms
56,072 KB
testcase_16 AC 222 ms
55,768 KB
testcase_17 AC 242 ms
56,128 KB
testcase_18 AC 236 ms
55,692 KB
testcase_19 AC 243 ms
55,880 KB
testcase_20 AC 242 ms
56,012 KB
testcase_21 AC 270 ms
55,508 KB
testcase_22 AC 208 ms
55,492 KB
testcase_23 AC 254 ms
55,816 KB
testcase_24 AC 246 ms
55,772 KB
testcase_25 AC 203 ms
56,024 KB
testcase_26 AC 205 ms
56,036 KB
testcase_27 AC 204 ms
56,468 KB
testcase_28 AC 270 ms
55,800 KB
testcase_29 AC 117 ms
55,500 KB
testcase_30 AC 119 ms
55,764 KB
testcase_31 AC 119 ms
56,064 KB
testcase_32 AC 118 ms
55,824 KB
testcase_33 AC 127 ms
55,804 KB
testcase_34 AC 122 ms
55,676 KB
testcase_35 AC 129 ms
55,920 KB
testcase_36 AC 131 ms
55,712 KB
testcase_37 AC 130 ms
56,152 KB
testcase_38 AC 144 ms
55,788 KB
testcase_39 AC 152 ms
55,804 KB
testcase_40 AC 200 ms
55,872 KB
testcase_41 AC 171 ms
55,828 KB
testcase_42 AC 146 ms
55,828 KB
testcase_43 AC 145 ms
56,104 KB
testcase_44 AC 273 ms
55,744 KB
testcase_45 AC 138 ms
55,496 KB
testcase_46 AC 155 ms
55,704 KB
testcase_47 AC 266 ms
56,040 KB
testcase_48 AC 211 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yuki129 {


    public Yuki129() {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        int M = scanner.nextInt();
        int MOD = 1000000000;

        long A = (N / 1000) / M;
        int K = (int) (N / 1000 - A * M);

        int[] dp = new int[M + 1];
        dp[0] = 1;
        dp[1] = 1;

        for (int i = 2; i <= M; i++) {
            for (int j = i; j >= 1; j--) {
                dp[j] = (dp[j] + dp[j - 1]) % MOD;
            }
        }
        System.out.println(dp[K]);

    }

    public static void main(String[] args) {
        Yuki129 hoge = new Yuki129();
    }
}

0