結果
問題 | No.741 AscNumber(Easy) |
ユーザー |
![]() |
提出日時 | 2025-01-12 03:16:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 716 ms / 2,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 4,203 ms |
コンパイル使用メモリ | 277,764 KB |
実行使用メモリ | 120,448 KB |
最終ジャッジ日時 | 2025-01-12 03:16:47 |
合計ジャッジ時間 | 14,391 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include <bits/stdc++.h>#include <iomanip>#include <functional>#include <sstream>#include <bit>#include <numeric>using namespace std;long P = 1e9 + 7;int main() {int N; cin >> N;// DP[i桁まで][今の桁の値] := ascの個数// あ〜同じ数字でもいいし、後へAscなのか。めちゃやさしいな。vector DP(N+1, vector<long>(10));DP[0][0] = 1;for (int i=0;i<N;i++) {for (int j=0;j<10;j++) {for (int k=j;k<10;k++) {DP[i+1][k] += DP[i][j];DP[i+1][k] %= P;}}}long res = 0;for (int i=0;i<10;i++) {res += DP[N][i];res %= P;}cout << res << endl;}