結果

問題 No.741 AscNumber(Easy)
ユーザー htensaihtensai
提出日時 2019-12-27 09:27:34
言語 Java21
(openjdk 21)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 75,304 KB
実行使用メモリ 106,596 KB
最終ジャッジ日時 2024-04-16 11:43:49
合計ジャッジ時間 13,397 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,092 KB
testcase_01 AC 128 ms
41,388 KB
testcase_02 AC 125 ms
41,040 KB
testcase_03 AC 128 ms
41,624 KB
testcase_04 AC 126 ms
41,252 KB
testcase_05 AC 127 ms
40,912 KB
testcase_06 AC 123 ms
41,588 KB
testcase_07 AC 116 ms
40,348 KB
testcase_08 AC 130 ms
41,612 KB
testcase_09 AC 114 ms
39,876 KB
testcase_10 AC 129 ms
41,152 KB
testcase_11 AC 125 ms
41,620 KB
testcase_12 AC 124 ms
41,740 KB
testcase_13 AC 127 ms
41,472 KB
testcase_14 AC 123 ms
41,380 KB
testcase_15 AC 127 ms
40,900 KB
testcase_16 AC 125 ms
41,424 KB
testcase_17 AC 128 ms
41,756 KB
testcase_18 AC 126 ms
41,444 KB
testcase_19 AC 128 ms
41,508 KB
testcase_20 AC 115 ms
39,872 KB
testcase_21 AC 127 ms
41,272 KB
testcase_22 AC 132 ms
41,132 KB
testcase_23 AC 124 ms
41,428 KB
testcase_24 AC 130 ms
40,996 KB
testcase_25 AC 126 ms
41,344 KB
testcase_26 AC 125 ms
41,108 KB
testcase_27 AC 127 ms
41,680 KB
testcase_28 AC 126 ms
41,292 KB
testcase_29 AC 125 ms
41,400 KB
testcase_30 AC 130 ms
41,748 KB
testcase_31 AC 128 ms
41,228 KB
testcase_32 AC 126 ms
41,132 KB
testcase_33 AC 115 ms
40,248 KB
testcase_34 AC 125 ms
41,096 KB
testcase_35 AC 328 ms
106,596 KB
testcase_36 AC 194 ms
67,496 KB
testcase_37 AC 250 ms
75,344 KB
testcase_38 AC 254 ms
76,524 KB
testcase_39 AC 210 ms
67,540 KB
testcase_40 AC 256 ms
76,764 KB
testcase_41 AC 319 ms
106,416 KB
testcase_42 AC 241 ms
76,524 KB
testcase_43 AC 200 ms
66,352 KB
testcase_44 AC 268 ms
80,464 KB
testcase_45 AC 295 ms
102,412 KB
testcase_46 AC 318 ms
106,320 KB
testcase_47 AC 147 ms
51,032 KB
testcase_48 AC 315 ms
106,380 KB
testcase_49 AC 282 ms
84,880 KB
testcase_50 AC 139 ms
47,132 KB
testcase_51 AC 201 ms
67,264 KB
testcase_52 AC 327 ms
101,848 KB
testcase_53 AC 336 ms
101,880 KB
testcase_54 AC 325 ms
102,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] dp = new int[n + 1][10];
        for (int i = 0; i < 10; i++) {
            dp[1][i] = i + 1;
        }
        for (int i = 2; i <= n; i++) {
            for (int j = 0; j < 10; j++) {
                if (j == 0) {
                    dp[i][j] = dp[i - 1][j];
                } else {
                    dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
                }
            }
        }
        System.out.println(dp[n][9]);
    }
}
0