結果
問題 | No.741 AscNumber(Easy) |
ユーザー |
![]() |
提出日時 | 2020-03-17 23:30:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 309 ms / 2,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 1,368 ms |
コンパイル使用メモリ | 165,904 KB |
実行使用メモリ | 81,536 KB |
最終ジャッジ日時 | 2024-11-30 23:27:55 |
合計ジャッジ時間 | 6,790 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mod = 1e9 + 7; const int inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; #define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) #define digit(N) cout << fixed << setprecision((N)) int dp[1000000][10][2]; int main() { int N; cin >> N; dp[0][0][0] = 1; for (int digit = 0; digit < N; digit++) { int c = 9; for (int last = 0; last < 10; last++) { for (int isless = 0; isless < 2; isless++) { for (int next = 0; next < 10; next++) { if (last <= next) (dp[digit + 1][next][isless] += dp[digit][last][isless]) %= mod; } } } } int ans = 0; for (int i = 0; i < 10; i++) { ans += dp[N][i][0] + dp[N][i][1]; ans %= mod; } cout << ans << "\n"; }