結果
| 問題 |
No.741 AscNumber(Easy)
|
| コンテスト | |
| ユーザー |
hanbei_dayo
|
| 提出日時 | 2020-08-17 23:58:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,253 bytes |
| コンパイル時間 | 896 ms |
| コンパイル使用メモリ | 100,312 KB |
| 実行使用メモリ | 18,944 KB |
| 最終ジャッジ日時 | 2024-10-11 11:31:01 |
| 合計ジャッジ時間 | 5,397 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 RE * 20 |
ソースコード
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
#include <cassert>
#include <complex>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1e8;
ll dp[100010][2][10];
int main() {
int n;
cin>>n;
dp[0][0][0]=1;
for(int i=0;i<=n;i++){
int x = ((i==0)?1:0);
for(int k=0;k<10;k++){
for(int l=k;l<10;l++){
if(l==x)dp[i+1][0][l] = (dp[i+1][0][l]+dp[i][0][k])%N;
else{
dp[i+1][1][l] = (dp[i+1][1][l]+dp[i][0][k])%N;
}
}
}
for(int k=0;k<10;k++){
for(int l=k;l<10;l++){
if(l==x)dp[i+1][1][l] = (dp[i+1][1][l]+dp[i][1][k])%N;
else{
dp[i+1][1][l] = (dp[i+1][1][l]+dp[i][1][k])%N;
}
}
}
}
ll ans = 0;
for(ll i=0;i<10;i++){
ans = (ans+dp[n][1][i])%N;
ans = (ans+dp[n][0][i])%N;
}
cout<<ans<<endl;
}
hanbei_dayo