結果

問題 No.129 お年玉(2)
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-20 21:59:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 395 ms / 5,000 ms
コード長 939 bytes
コンパイル時間 2,254 ms
コンパイル使用メモリ 74,384 KB
実行使用メモリ 243,900 KB
最終ジャッジ日時 2023-08-18 17:07:32
合計ジャッジ時間 14,620 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
64,344 KB
testcase_01 AC 120 ms
44,028 KB
testcase_02 AC 119 ms
44,996 KB
testcase_03 AC 119 ms
44,840 KB
testcase_04 AC 119 ms
44,552 KB
testcase_05 AC 200 ms
100,868 KB
testcase_06 AC 298 ms
187,992 KB
testcase_07 AC 358 ms
230,004 KB
testcase_08 AC 187 ms
91,596 KB
testcase_09 AC 300 ms
189,444 KB
testcase_10 AC 359 ms
230,216 KB
testcase_11 AC 283 ms
188,720 KB
testcase_12 AC 186 ms
86,988 KB
testcase_13 AC 166 ms
78,128 KB
testcase_14 AC 304 ms
187,748 KB
testcase_15 AC 286 ms
186,904 KB
testcase_16 AC 294 ms
186,948 KB
testcase_17 AC 295 ms
188,068 KB
testcase_18 AC 298 ms
191,128 KB
testcase_19 AC 236 ms
131,124 KB
testcase_20 AC 366 ms
230,584 KB
testcase_21 AC 366 ms
230,808 KB
testcase_22 AC 276 ms
187,688 KB
testcase_23 AC 361 ms
230,744 KB
testcase_24 AC 185 ms
89,324 KB
testcase_25 AC 280 ms
187,504 KB
testcase_26 AC 243 ms
131,432 KB
testcase_27 AC 246 ms
135,540 KB
testcase_28 AC 395 ms
243,900 KB
testcase_29 AC 120 ms
55,704 KB
testcase_30 AC 117 ms
55,936 KB
testcase_31 AC 120 ms
55,652 KB
testcase_32 AC 120 ms
55,676 KB
testcase_33 AC 119 ms
55,588 KB
testcase_34 AC 127 ms
55,732 KB
testcase_35 AC 121 ms
55,812 KB
testcase_36 AC 135 ms
57,784 KB
testcase_37 AC 134 ms
55,392 KB
testcase_38 AC 166 ms
79,580 KB
testcase_39 AC 182 ms
87,380 KB
testcase_40 AC 247 ms
132,108 KB
testcase_41 AC 209 ms
114,672 KB
testcase_42 AC 167 ms
79,700 KB
testcase_43 AC 155 ms
67,492 KB
testcase_44 AC 272 ms
186,312 KB
testcase_45 AC 157 ms
67,956 KB
testcase_46 AC 157 ms
67,576 KB
testcase_47 AC 354 ms
230,688 KB
testcase_48 AC 201 ms
114,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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{
            long[][] judge = new long[(int)(m-amari+1)][(int)(amari+1)];
            for(int i=0; i<amari+1; i++){
                judge[0][i]=1;
            }
            for(int i=0; i<m-amari+1; i++){
                judge[i][0]=1;
            }
            for(int i=1; i<m-amari+1; i++){
                for(int j=1; j<amari+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