結果

問題 No.741 AscNumber(Easy)
ユーザー takeya_okinotakeya_okino
提出日時 2019-06-15 20:03:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 450 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 1,850 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 151,092 KB
最終ジャッジ日時 2024-04-30 21:01:32
合計ジャッジ時間 13,701 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
53,812 KB
testcase_01 AC 109 ms
54,112 KB
testcase_02 AC 111 ms
53,836 KB
testcase_03 AC 101 ms
52,756 KB
testcase_04 AC 98 ms
53,092 KB
testcase_05 AC 143 ms
54,776 KB
testcase_06 AC 113 ms
54,240 KB
testcase_07 AC 116 ms
54,416 KB
testcase_08 AC 112 ms
53,824 KB
testcase_09 AC 102 ms
52,860 KB
testcase_10 AC 112 ms
54,016 KB
testcase_11 AC 111 ms
53,888 KB
testcase_12 AC 111 ms
54,244 KB
testcase_13 AC 113 ms
54,044 KB
testcase_14 AC 111 ms
54,152 KB
testcase_15 AC 110 ms
53,908 KB
testcase_16 AC 116 ms
54,044 KB
testcase_17 AC 122 ms
54,108 KB
testcase_18 AC 101 ms
52,872 KB
testcase_19 AC 100 ms
52,736 KB
testcase_20 AC 95 ms
52,736 KB
testcase_21 AC 106 ms
54,028 KB
testcase_22 AC 98 ms
52,976 KB
testcase_23 AC 122 ms
53,884 KB
testcase_24 AC 110 ms
52,612 KB
testcase_25 AC 118 ms
54,268 KB
testcase_26 AC 114 ms
54,180 KB
testcase_27 AC 102 ms
53,044 KB
testcase_28 AC 101 ms
53,012 KB
testcase_29 AC 113 ms
54,276 KB
testcase_30 AC 96 ms
52,712 KB
testcase_31 AC 109 ms
53,960 KB
testcase_32 AC 108 ms
53,940 KB
testcase_33 AC 103 ms
53,116 KB
testcase_34 AC 104 ms
53,116 KB
testcase_35 AC 415 ms
147,028 KB
testcase_36 AC 242 ms
92,896 KB
testcase_37 AC 262 ms
115,936 KB
testcase_38 AC 271 ms
115,228 KB
testcase_39 AC 243 ms
92,140 KB
testcase_40 AC 273 ms
115,048 KB
testcase_41 AC 392 ms
137,300 KB
testcase_42 AC 263 ms
115,188 KB
testcase_43 AC 231 ms
86,152 KB
testcase_44 AC 372 ms
131,856 KB
testcase_45 AC 368 ms
132,340 KB
testcase_46 AC 410 ms
141,000 KB
testcase_47 AC 166 ms
66,248 KB
testcase_48 AC 406 ms
140,788 KB
testcase_49 AC 382 ms
137,764 KB
testcase_50 AC 147 ms
63,252 KB
testcase_51 AC 223 ms
86,200 KB
testcase_52 AC 450 ms
151,092 KB
testcase_53 AC 419 ms
150,788 KB
testcase_54 AC 407 ms
150,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long MOD = (long)Math.pow(10, 9) + 7;
    long[][] dp = new long[n][10];
    for(int j = 0; j < 10; j++) {
      dp[0][j] = 1;
    }
    for(int i = 1; i < n; i++) {
      dp[i][0] = dp[i - 1][0]; 
      for(int j = 1; j < 10; j++) {
        dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % MOD;
      }
    }
    long ans = 0;
    for(int j = 0; j < 10; j++) {
      ans = (ans + dp[n - 1][j]) % MOD;
    }
    System.out.println(ans);
  }
}
0