結果
問題 |
No.741 AscNumber(Easy)
|
ユーザー |
|
提出日時 | 2021-07-03 03:56:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 168 ms / 2,000 ms |
コード長 | 582 bytes |
コンパイル時間 | 1,863 ms |
コンパイル使用メモリ | 197,144 KB |
最終ジャッジ日時 | 2025-01-22 17:06:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; const int MOD = 1e9 + 7; int main() { int N; cin >> N; vector<vector<ll>> dp(N + 1, vector<ll>(10)); rep(i, 10) dp[1][i] = 1; for (int i = 2; i <= N; ++i) { ll cur = 0; rep(j, 10) { cur += dp[i - 1][j]; cur %= MOD; dp[i][j] += cur; dp[i][j] %= MOD; } } ll ans = accumulate(dp[N].begin(), dp[N].end(), 0LL); ans %= MOD; cout << ans << endl; return 0; }