結果

問題 No.741 AscNumber(Easy)
ユーザー takeya_okinotakeya_okino
提出日時 2019-06-15 20:03:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 505 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 2,840 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 193,900 KB
最終ジャッジ日時 2023-08-13 02:34:22
合計ジャッジ時間 17,020 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,736 KB
testcase_01 AC 120 ms
55,596 KB
testcase_02 AC 121 ms
55,588 KB
testcase_03 AC 122 ms
55,756 KB
testcase_04 AC 122 ms
55,936 KB
testcase_05 AC 121 ms
55,704 KB
testcase_06 AC 120 ms
55,960 KB
testcase_07 AC 121 ms
55,792 KB
testcase_08 AC 121 ms
55,848 KB
testcase_09 AC 118 ms
54,248 KB
testcase_10 AC 121 ms
55,632 KB
testcase_11 AC 119 ms
55,792 KB
testcase_12 AC 120 ms
55,612 KB
testcase_13 AC 120 ms
55,888 KB
testcase_14 AC 119 ms
55,776 KB
testcase_15 AC 123 ms
55,828 KB
testcase_16 AC 124 ms
55,984 KB
testcase_17 AC 122 ms
55,848 KB
testcase_18 AC 126 ms
55,944 KB
testcase_19 AC 122 ms
55,964 KB
testcase_20 AC 123 ms
55,852 KB
testcase_21 AC 122 ms
55,952 KB
testcase_22 AC 121 ms
55,732 KB
testcase_23 AC 122 ms
55,956 KB
testcase_24 AC 123 ms
55,860 KB
testcase_25 AC 121 ms
55,436 KB
testcase_26 AC 123 ms
55,800 KB
testcase_27 AC 122 ms
55,960 KB
testcase_28 AC 122 ms
55,748 KB
testcase_29 AC 122 ms
55,808 KB
testcase_30 AC 123 ms
56,268 KB
testcase_31 AC 123 ms
56,028 KB
testcase_32 AC 122 ms
55,784 KB
testcase_33 AC 122 ms
55,648 KB
testcase_34 AC 122 ms
55,988 KB
testcase_35 AC 464 ms
147,028 KB
testcase_36 AC 271 ms
93,780 KB
testcase_37 AC 304 ms
114,864 KB
testcase_38 AC 304 ms
114,716 KB
testcase_39 AC 267 ms
94,168 KB
testcase_40 AC 312 ms
115,252 KB
testcase_41 AC 434 ms
137,988 KB
testcase_42 AC 296 ms
114,900 KB
testcase_43 AC 254 ms
87,524 KB
testcase_44 AC 399 ms
132,344 KB
testcase_45 AC 418 ms
137,504 KB
testcase_46 AC 455 ms
142,964 KB
testcase_47 AC 185 ms
67,656 KB
testcase_48 AC 456 ms
143,440 KB
testcase_49 AC 422 ms
137,396 KB
testcase_50 AC 160 ms
64,508 KB
testcase_51 AC 261 ms
87,368 KB
testcase_52 AC 505 ms
193,684 KB
testcase_53 AC 504 ms
193,852 KB
testcase_54 AC 493 ms
193,900 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