結果

問題 No.189 SUPER HAPPY DAY
ユーザー hirokazu1020hirokazu1020
提出日時 2015-04-22 01:21:19
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,157 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 75,976 KB
実行使用メモリ 7,932 KB
最終ジャッジ日時 2023-09-18 07:20:10
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,556 KB
testcase_01 AC 2 ms
5,436 KB
testcase_02 AC 2 ms
5,360 KB
testcase_03 AC 2 ms
5,588 KB
testcase_04 AC 2 ms
5,400 KB
testcase_05 AC 2 ms
5,424 KB
testcase_06 AC 2 ms
5,732 KB
testcase_07 AC 2 ms
5,480 KB
testcase_08 AC 2 ms
5,552 KB
testcase_09 AC 2 ms
5,532 KB
testcase_10 AC 2 ms
5,392 KB
testcase_11 AC 2 ms
5,560 KB
testcase_12 AC 2 ms
5,544 KB
testcase_13 AC 6 ms
6,720 KB
testcase_14 AC 8 ms
7,228 KB
testcase_15 AC 8 ms
6,740 KB
testcase_16 AC 9 ms
6,800 KB
testcase_17 AC 10 ms
7,532 KB
testcase_18 AC 8 ms
6,760 KB
testcase_19 AC 10 ms
7,932 KB
testcase_20 AC 4 ms
5,960 KB
testcase_21 AC 4 ms
6,240 KB
testcase_22 AC 3 ms
5,596 KB
testcase_23 AC 9 ms
6,696 KB
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())


#define MOD 1000000009


int dp1[201][2][2000];
int dp2[201][2][2000];

string m,d;

void f(int dp[201][2][2000],string &n){
	dp[0][0][0]=1;
	rep(i,n.size())rep(j,2)rep(k,2000)if(dp[i][j][k]){
		int v=dp[i][j][k];
		int md=(j==0?n[i]-'0':9)+1;
		rep(d,md){
			(dp[i+1][j||d<n[i]-'0'][k+d]+=v)%=MOD;
		}
	}
}


int main(){
	cin>>m>>d;
	f(dp1,m);
	f(dp2,d);
	long long ans=0;
	for(int i=1;i<2000;i++){
		ans+=(long long)dp1[m.size()][0][i]*dp2[d.size()][0][i]%MOD;
		ans+=(long long)dp1[m.size()][0][i]*dp2[d.size()][1][i]%MOD;
		ans+=(long long)dp1[m.size()][1][i]*dp2[d.size()][0][i]%MOD;
		ans+=(long long)dp1[m.size()][1][i]*dp2[d.size()][1][i]%MOD;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}
0