結果

問題 No.741 AscNumber(Easy)
ユーザー GrenacheGrenache
提出日時 2019-04-29 18:16:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 925 bytes
コンパイル時間 3,371 ms
コンパイル使用メモリ 74,552 KB
実行使用メモリ 136,296 KB
最終ジャッジ日時 2023-08-26 05:17:05
合計ジャッジ時間 16,207 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,592 KB
testcase_01 AC 123 ms
55,420 KB
testcase_02 AC 124 ms
55,528 KB
testcase_03 AC 124 ms
53,672 KB
testcase_04 AC 125 ms
55,856 KB
testcase_05 AC 124 ms
55,856 KB
testcase_06 AC 125 ms
55,488 KB
testcase_07 AC 124 ms
55,600 KB
testcase_08 AC 125 ms
55,864 KB
testcase_09 AC 125 ms
54,416 KB
testcase_10 AC 126 ms
55,992 KB
testcase_11 AC 126 ms
55,772 KB
testcase_12 AC 126 ms
56,156 KB
testcase_13 AC 126 ms
55,604 KB
testcase_14 AC 126 ms
55,640 KB
testcase_15 AC 126 ms
55,992 KB
testcase_16 AC 126 ms
55,284 KB
testcase_17 AC 126 ms
53,728 KB
testcase_18 AC 126 ms
55,744 KB
testcase_19 AC 127 ms
55,612 KB
testcase_20 AC 131 ms
55,708 KB
testcase_21 AC 126 ms
55,672 KB
testcase_22 AC 128 ms
55,592 KB
testcase_23 AC 130 ms
56,108 KB
testcase_24 AC 127 ms
55,812 KB
testcase_25 AC 126 ms
56,220 KB
testcase_26 AC 127 ms
55,852 KB
testcase_27 AC 126 ms
55,664 KB
testcase_28 AC 128 ms
55,476 KB
testcase_29 AC 126 ms
56,332 KB
testcase_30 AC 128 ms
55,812 KB
testcase_31 AC 127 ms
55,920 KB
testcase_32 AC 126 ms
56,316 KB
testcase_33 AC 126 ms
55,680 KB
testcase_34 AC 129 ms
56,056 KB
testcase_35 AC 394 ms
130,120 KB
testcase_36 AC 251 ms
85,828 KB
testcase_37 AC 268 ms
92,720 KB
testcase_38 AC 268 ms
91,504 KB
testcase_39 AC 250 ms
85,416 KB
testcase_40 AC 289 ms
101,604 KB
testcase_41 AC 362 ms
123,956 KB
testcase_42 AC 261 ms
91,256 KB
testcase_43 AC 237 ms
84,524 KB
testcase_44 AC 320 ms
111,776 KB
testcase_45 AC 337 ms
114,304 KB
testcase_46 AC 372 ms
132,684 KB
testcase_47 AC 182 ms
66,920 KB
testcase_48 AC 372 ms
132,156 KB
testcase_49 AC 343 ms
117,420 KB
testcase_50 AC 167 ms
64,524 KB
testcase_51 AC 237 ms
82,076 KB
testcase_52 AC 396 ms
134,444 KB
testcase_53 AC 396 ms
134,380 KB
testcase_54 AC 398 ms
136,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Scanner;


public class Main_yukicoder741 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		final int MOD = 1_000_000_007;

		int n = sc.nextInt();

		long[][] dp = new long[10][n];
		for (int i = 0; i < 10; i++) {
			dp[i][0] = 1;
		}
		
		for (int i = 0; i < n - 1; i++) {
			for (int j = 0; j < 10; j++) {
				for (int k = j; k < 10; k++) {
					dp[k][i + 1] += dp[j][i];
					dp[k][i + 1] %= MOD;
				}
			}
		}
		
		long ans = 0;
		for (int i = 0; i < 10; i++) {
			ans += dp[i][n - 1];
			ans %= MOD;
		}
		
		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0