結果
| 問題 |
No.741 AscNumber(Easy)
|
| コンテスト | |
| ユーザー |
momotaro1303
|
| 提出日時 | 2019-09-23 22:07:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 237 ms / 2,000 ms |
| コード長 | 461 bytes |
| コンパイル時間 | 1,597 ms |
| コンパイル使用メモリ | 167,092 KB |
| 実行使用メモリ | 81,664 KB |
| 最終ジャッジ日時 | 2024-09-19 04:37:15 |
| 合計ジャッジ時間 | 5,991 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 55 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
int N;
ll dp[1000005][10];
ll ans;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin>>N;
for(int j=1; j<=9; j++){
dp[1][j]++;
}
for(int i=2; i<=N; i++){
for(int j=1; j<=9; j++){
for(int k=1; k<=j; k++){
dp[i][j]=(dp[i][j]+dp[i-1][k])%mod;
}
}
}
for(int i=1; i<=N; i++){
for(int j=1; j<=9; j++){
ans=(ans+dp[i][j])%mod;
}
}
cout<<ans+1<<endl;
}
momotaro1303