結果

問題 No.741 AscNumber(Easy)
ユーザー fukafukatanifukafukatani
提出日時 2018-11-18 15:44:59
言語 Rust
(1.77.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 13,603 ms
コンパイル使用メモリ 401,068 KB
実行使用メモリ 72,184 KB
最終ジャッジ日時 2024-06-06 20:49:23
合計ジャッジ時間 17,258 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,816 KB
testcase_03 AC 1 ms
6,816 KB
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 0 ms
6,944 KB
testcase_09 AC 0 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 0 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 0 ms
6,944 KB
testcase_16 AC 1 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
testcase_20 AC 1 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,944 KB
testcase_23 AC 1 ms
6,944 KB
testcase_24 AC 1 ms
6,944 KB
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 1 ms
6,940 KB
testcase_29 AC 0 ms
6,944 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 1 ms
6,940 KB
testcase_34 AC 1 ms
6,944 KB
testcase_35 AC 106 ms
68,904 KB
testcase_36 AC 46 ms
31,044 KB
testcase_37 AC 54 ms
36,192 KB
testcase_38 AC 54 ms
35,736 KB
testcase_39 AC 45 ms
30,536 KB
testcase_40 AC 60 ms
40,788 KB
testcase_41 AC 94 ms
62,820 KB
testcase_42 AC 52 ms
34,216 KB
testcase_43 AC 36 ms
25,244 KB
testcase_44 AC 73 ms
49,688 KB
testcase_45 AC 79 ms
53,320 KB
testcase_46 AC 101 ms
65,596 KB
testcase_47 AC 19 ms
12,588 KB
testcase_48 AC 101 ms
65,592 KB
testcase_49 AC 86 ms
55,124 KB
testcase_50 AC 13 ms
9,088 KB
testcase_51 AC 40 ms
26,436 KB
testcase_52 AC 113 ms
72,164 KB
testcase_53 AC 115 ms
72,184 KB
testcase_54 AC 112 ms
71,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let mut dp = vec![vec![0; 10]; n];
    let big_int = 1000_000_000 + 7;

    for j in 0..10 {
        dp[0][j] = 1;
    }

    for i in 0..n - 1 {
        dp[i + 1][0] = dp[i][0];
        for j in 1..10 {
            dp[i + 1][j] = dp[i][j] + dp[i + 1][j - 1];
            dp[i + 1][j] %= big_int;
        }
    }
    let mut ans = 0;
    for j in 1..10 {
        ans += dp[n - 1][j];
        ans %= big_int;
    }

    println!("{:?}", ans + 1);
}
0