結果
| 問題 |
No.1964 sum = length
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2022-06-03 21:34:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 418 ms / 2,000 ms |
| コード長 | 715 bytes |
| コンパイル時間 | 3,875 ms |
| コンパイル使用メモリ | 233,020 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-21 02:29:23 |
| 合計ジャッジ時間 | 12,868 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define INF 1000000000000000000
#define MOD 998244353
#define MAX 1000000
int main(){
int n;
cin>>n;
int M=300;
vector<vector<ll>> dp(n,vector<ll>(2*M+1,0));
for(int num=1;num<=M;num++){
int j=num-to_string(num).size()+M;
if(0<=j&&j<=2*M){
dp[0][j]++;
}
}
for(int i=1;i<n;i++){
for(int j=0;j<=2*M;j++){
for(int num=1;num<=M;num++){
int nj=j+(num-to_string(num).size()-1);
if(0<=nj&&nj<=2*M){
dp[i][nj]+=dp[i-1][j];
dp[i][nj]%=MOD;
}
}
}
}
cout<<dp[n-1][M]<<'\n';
}
monnu