結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
55,780 KB
testcase_01 AC 113 ms
55,836 KB
testcase_02 AC 111 ms
55,616 KB
testcase_03 AC 115 ms
55,576 KB
testcase_04 AC 116 ms
55,944 KB
testcase_05 AC 113 ms
55,560 KB
testcase_06 AC 110 ms
55,496 KB
testcase_07 AC 112 ms
56,204 KB
testcase_08 AC 115 ms
56,004 KB
testcase_09 AC 113 ms
55,612 KB
testcase_10 AC 114 ms
55,612 KB
testcase_11 AC 113 ms
55,648 KB
testcase_12 AC 111 ms
55,716 KB
testcase_13 AC 112 ms
55,564 KB
testcase_14 AC 116 ms
55,700 KB
testcase_15 AC 117 ms
55,904 KB
testcase_16 AC 120 ms
55,888 KB
testcase_17 AC 112 ms
56,104 KB
testcase_18 AC 114 ms
56,380 KB
testcase_19 AC 109 ms
55,808 KB
testcase_20 AC 108 ms
55,716 KB
testcase_21 AC 109 ms
56,388 KB
testcase_22 AC 115 ms
55,628 KB
testcase_23 AC 116 ms
55,720 KB
testcase_24 AC 116 ms
55,700 KB
testcase_25 AC 114 ms
55,880 KB
testcase_26 AC 116 ms
56,288 KB
testcase_27 AC 113 ms
55,652 KB
testcase_28 AC 119 ms
56,340 KB
testcase_29 AC 119 ms
55,804 KB
testcase_30 AC 117 ms
55,648 KB
testcase_31 AC 121 ms
56,008 KB
testcase_32 AC 114 ms
56,112 KB
testcase_33 AC 113 ms
55,928 KB
testcase_34 AC 113 ms
55,908 KB
testcase_35 AC 367 ms
132,308 KB
testcase_36 AC 230 ms
85,532 KB
testcase_37 AC 244 ms
91,896 KB
testcase_38 AC 242 ms
91,200 KB
testcase_39 AC 224 ms
84,912 KB
testcase_40 AC 265 ms
101,840 KB
testcase_41 AC 340 ms
124,464 KB
testcase_42 AC 234 ms
91,556 KB
testcase_43 AC 213 ms
84,640 KB
testcase_44 AC 290 ms
111,948 KB
testcase_45 AC 307 ms
114,068 KB
testcase_46 AC 344 ms
132,892 KB
testcase_47 AC 160 ms
67,088 KB
testcase_48 AC 344 ms
132,884 KB
testcase_49 AC 316 ms
117,916 KB
testcase_50 AC 150 ms
64,088 KB
testcase_51 AC 212 ms
82,336 KB
testcase_52 AC 364 ms
134,512 KB
testcase_53 AC 373 ms
134,668 KB
testcase_54 AC 355 ms
136,424 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;
					if (dp[k][i + 1] >= MOD) {
						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