結果

問題 No.741 AscNumber(Easy)
ユーザー fukafukatanifukafukatani
提出日時 2018-11-18 15:44:59
言語 Rust
(1.77.0)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 3,259 ms
コンパイル使用メモリ 148,444 KB
実行使用メモリ 72,228 KB
最終ジャッジ日時 2023-08-26 01:54:19
合計ジャッジ時間 7,106 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 0 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 0 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 0 ms
4,380 KB
testcase_32 AC 1 ms
4,504 KB
testcase_33 AC 0 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 108 ms
68,748 KB
testcase_36 AC 49 ms
30,964 KB
testcase_37 AC 55 ms
36,108 KB
testcase_38 AC 53 ms
35,596 KB
testcase_39 AC 45 ms
30,428 KB
testcase_40 AC 60 ms
40,592 KB
testcase_41 AC 99 ms
62,852 KB
testcase_42 AC 51 ms
34,136 KB
testcase_43 AC 37 ms
25,220 KB
testcase_44 AC 76 ms
49,768 KB
testcase_45 AC 83 ms
53,396 KB
testcase_46 AC 101 ms
65,736 KB
testcase_47 AC 18 ms
12,684 KB
testcase_48 AC 103 ms
65,720 KB
testcase_49 AC 84 ms
55,228 KB
testcase_50 AC 13 ms
8,988 KB
testcase_51 AC 40 ms
26,476 KB
testcase_52 AC 113 ms
72,228 KB
testcase_53 AC 112 ms
72,180 KB
testcase_54 AC 113 ms
71,420 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