結果

問題 No.741 AscNumber(Easy)
ユーザー tentententen
提出日時 2023-11-15 20:20:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 1,789 bytes
コンパイル時間 2,407 ms
コンパイル使用メモリ 83,428 KB
実行使用メモリ 115,884 KB
最終ジャッジ日時 2023-11-15 20:20:32
合計ジャッジ時間 9,813 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
53,988 KB
testcase_01 AC 52 ms
54,004 KB
testcase_02 AC 51 ms
53,992 KB
testcase_03 AC 52 ms
53,996 KB
testcase_04 AC 51 ms
53,992 KB
testcase_05 AC 51 ms
54,000 KB
testcase_06 AC 51 ms
53,984 KB
testcase_07 AC 51 ms
53,992 KB
testcase_08 AC 51 ms
53,992 KB
testcase_09 AC 51 ms
54,000 KB
testcase_10 AC 52 ms
53,988 KB
testcase_11 AC 52 ms
53,992 KB
testcase_12 AC 51 ms
53,984 KB
testcase_13 AC 51 ms
53,988 KB
testcase_14 AC 52 ms
53,996 KB
testcase_15 AC 52 ms
53,988 KB
testcase_16 AC 50 ms
51,920 KB
testcase_17 AC 52 ms
53,988 KB
testcase_18 AC 51 ms
53,984 KB
testcase_19 AC 51 ms
54,000 KB
testcase_20 AC 50 ms
53,992 KB
testcase_21 AC 51 ms
53,992 KB
testcase_22 AC 51 ms
54,004 KB
testcase_23 AC 51 ms
53,984 KB
testcase_24 AC 51 ms
54,000 KB
testcase_25 AC 52 ms
53,988 KB
testcase_26 AC 52 ms
53,992 KB
testcase_27 AC 51 ms
53,992 KB
testcase_28 AC 52 ms
53,972 KB
testcase_29 AC 50 ms
54,000 KB
testcase_30 AC 53 ms
53,992 KB
testcase_31 AC 53 ms
54,000 KB
testcase_32 AC 52 ms
53,996 KB
testcase_33 AC 52 ms
54,000 KB
testcase_34 AC 52 ms
54,000 KB
testcase_35 AC 237 ms
115,884 KB
testcase_36 AC 131 ms
79,352 KB
testcase_37 AC 172 ms
88,708 KB
testcase_38 AC 173 ms
88,696 KB
testcase_39 AC 129 ms
79,424 KB
testcase_40 AC 176 ms
88,692 KB
testcase_41 AC 225 ms
115,764 KB
testcase_42 AC 134 ms
79,380 KB
testcase_43 AC 126 ms
79,332 KB
testcase_44 AC 187 ms
92,952 KB
testcase_45 AC 189 ms
97,036 KB
testcase_46 AC 229 ms
115,732 KB
testcase_47 AC 90 ms
64,440 KB
testcase_48 AC 229 ms
115,752 KB
testcase_49 AC 199 ms
97,036 KB
testcase_50 AC 92 ms
60,148 KB
testcase_51 AC 127 ms
79,344 KB
testcase_52 AC 238 ms
115,768 KB
testcase_53 AC 234 ms
115,756 KB
testcase_54 AC 235 ms
115,776 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