結果

問題 No.741 AscNumber(Easy)
ユーザー tentententen
提出日時 2023-01-10 09:20:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 233 ms / 2,000 ms
コード長 1,795 bytes
コンパイル時間 3,542 ms
コンパイル使用メモリ 92,392 KB
実行使用メモリ 114,456 KB
最終ジャッジ日時 2023-08-23 08:58:14
合計ジャッジ時間 10,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,436 KB
testcase_01 AC 43 ms
49,724 KB
testcase_02 AC 43 ms
49,496 KB
testcase_03 AC 43 ms
49,572 KB
testcase_04 AC 43 ms
49,468 KB
testcase_05 AC 43 ms
49,464 KB
testcase_06 AC 43 ms
49,524 KB
testcase_07 AC 42 ms
49,832 KB
testcase_08 AC 42 ms
49,360 KB
testcase_09 AC 43 ms
50,080 KB
testcase_10 AC 41 ms
49,548 KB
testcase_11 AC 42 ms
49,768 KB
testcase_12 AC 43 ms
49,480 KB
testcase_13 AC 44 ms
49,572 KB
testcase_14 AC 43 ms
49,544 KB
testcase_15 AC 43 ms
49,432 KB
testcase_16 AC 43 ms
49,628 KB
testcase_17 AC 44 ms
49,436 KB
testcase_18 AC 44 ms
49,520 KB
testcase_19 AC 43 ms
49,368 KB
testcase_20 AC 43 ms
49,444 KB
testcase_21 AC 43 ms
49,600 KB
testcase_22 AC 42 ms
49,392 KB
testcase_23 AC 42 ms
49,708 KB
testcase_24 AC 42 ms
49,596 KB
testcase_25 AC 44 ms
49,472 KB
testcase_26 AC 43 ms
49,376 KB
testcase_27 AC 42 ms
49,720 KB
testcase_28 AC 43 ms
49,596 KB
testcase_29 AC 44 ms
49,716 KB
testcase_30 AC 42 ms
49,536 KB
testcase_31 AC 43 ms
49,408 KB
testcase_32 AC 43 ms
49,784 KB
testcase_33 AC 43 ms
49,440 KB
testcase_34 AC 43 ms
49,428 KB
testcase_35 AC 228 ms
112,664 KB
testcase_36 AC 123 ms
75,888 KB
testcase_37 AC 163 ms
84,832 KB
testcase_38 AC 163 ms
84,904 KB
testcase_39 AC 126 ms
75,716 KB
testcase_40 AC 170 ms
84,932 KB
testcase_41 AC 221 ms
114,156 KB
testcase_42 AC 161 ms
84,852 KB
testcase_43 AC 117 ms
73,816 KB
testcase_44 AC 182 ms
89,248 KB
testcase_45 AC 187 ms
93,400 KB
testcase_46 AC 228 ms
112,568 KB
testcase_47 AC 79 ms
60,408 KB
testcase_48 AC 229 ms
112,608 KB
testcase_49 AC 214 ms
113,996 KB
testcase_50 AC 72 ms
56,088 KB
testcase_51 AC 122 ms
75,808 KB
testcase_52 AC 231 ms
112,556 KB
testcase_53 AC 233 ms
112,776 KB
testcase_54 AC 230 ms
114,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

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

class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0