結果
問題 | No.741 AscNumber(Easy) |
ユーザー |
![]() |
提出日時 | 2021-05-06 12:03:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 889 ms / 2,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 1,864 ms |
コンパイル使用メモリ | 200,732 KB |
最終ジャッジ日時 | 2025-01-21 07:45:13 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; ll mod = 1000000007; int main(){ ll N; cin >> N; vector<vector<vector<ll>>> dp(N + 2, vector<vector<ll>>(2, vector<ll>(10, 0))); dp[1][1][0] = 1; dp[1][0][1] = 1; for(int i = 1; i <= N; i++){ for(int j = 0; j <= 9; j++)for(int k = j; k <= 9; k++){ dp[i + 1][1][k] = (dp[i + 1][1][k] + dp[i][1][j]) % mod; if(k == 0)dp[i + 1][0][k] += dp[i][0][j]; } } ll cnt = 0; for(int i = 0; i <= 9; i++)cnt = (cnt + dp[N + 1][1][i]) % mod; cout << cnt << endl; }