結果

問題 No.1964 sum = length
ユーザー kzyKTkzyKT
提出日時 2022-06-03 21:45:42
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,443 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 160,288 KB
実行使用メモリ 11,400 KB
最終ジャッジ日時 2023-10-21 01:46:02
合計ジャッジ時間 60,527 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
4,348 KB
testcase_01 AC 17 ms
4,348 KB
testcase_02 AC 257 ms
4,348 KB
testcase_03 AC 17 ms
4,348 KB
testcase_04 AC 32 ms
4,348 KB
testcase_05 AC 46 ms
4,348 KB
testcase_06 AC 62 ms
4,348 KB
testcase_07 AC 76 ms
4,348 KB
testcase_08 AC 91 ms
4,348 KB
testcase_09 AC 106 ms
4,348 KB
testcase_10 AC 121 ms
4,348 KB
testcase_11 AC 137 ms
4,348 KB
testcase_12 AC 630 ms
4,348 KB
testcase_13 AC 916 ms
4,636 KB
testcase_14 AC 1,246 ms
5,020 KB
testcase_15 AC 1,411 ms
5,212 KB
testcase_16 AC 242 ms
4,348 KB
testcase_17 AC 721 ms
4,412 KB
testcase_18 AC 810 ms
4,516 KB
testcase_19 AC 527 ms
4,348 KB
testcase_20 AC 572 ms
4,348 KB
testcase_21 AC 226 ms
4,348 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 AC 1,965 ms
5,852 KB
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 AC 1,561 ms
5,384 KB
testcase_33 AC 1,520 ms
5,332 KB
testcase_34 TLE -
testcase_35 AC 1,756 ms
5,608 KB
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=998244353,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

ll mod_pow(ll x,ll n,ll mod){
  if(!n)return 1;
  ll res=mod_pow(x*x%mod,n/2,mod);
  if(n&1)res=res*x%mod;
  return res;
}

ll dp[222][2222];

void Main() {
  ll n,M=1000;
  cin >> n;
  dp[0][M-n+1]=1;
  rep(i,n) {
    rep(j,2222) {
      REP(x,1,2222) {
        ll k=1;
        if(x>=10) k=2;
        if(x>=100) k=3;
        if(x>=1000) k=4;
        if(j+x-k>=0&&j+x-k<=2000) {
          dp[i+1][j+x-k]+=dp[i][j];
          dp[i+1][j+x-k]%=MAX;
        }
      }
    }
  }
  pr(dp[n][M]);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}
0