結果

問題 No.189 SUPER HAPPY DAY
ユーザー 沙耶花沙耶花
提出日時 2021-11-03 23:26:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 892 bytes
コンパイル時間 4,601 ms
コンパイル使用メモリ 258,396 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 16:30:19
合計ジャッジ時間 5,794 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 4 ms
5,248 KB
testcase_02 AC 3 ms
5,248 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 23 ms
5,376 KB
testcase_14 AC 29 ms
5,376 KB
testcase_15 AC 26 ms
5,376 KB
testcase_16 AC 27 ms
5,376 KB
testcase_17 AC 30 ms
5,376 KB
testcase_18 AC 25 ms
5,376 KB
testcase_19 AC 33 ms
5,376 KB
testcase_20 AC 14 ms
5,376 KB
testcase_21 AC 15 ms
5,376 KB
testcase_22 AC 6 ms
5,376 KB
testcase_23 AC 26 ms
5,376 KB
testcase_24 AC 24 ms
5,376 KB
testcase_25 AC 51 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

vector<mint> get(string s){
	vector dp(2001,vector<mint>(2,0));
	dp[0][0] = 1;
	
	rep(i,s.size()){
		vector ndp(2001,vector<mint>(2,0));
		rep(j,2001){
			rep(k,2){
				if(dp[j][k]==0)continue;
				for(int l=0;l<10;l++){
					int nj = j + l;
					int nk = k;
					if(k==0 && s[i]-'0'<l)break;
					if(s[i]-'0'>l)nk = 1;
					ndp[nj][nk] += dp[j][k];
				}
			}
		}
		swap(dp,ndp);
	}
	vector<mint> ret(2001,0);
	rep(i,2001)ret[i] = dp[i][0] + dp[i][1];
	return ret;
}

int main(){	
	mint::set_mod(1000000009);
	
	string s,t;
	cin>>s>>t;
	
	auto a = get(s);
	auto b = get(t);
	mint ans = 0;
	for(int i=1;i<a.size();i++){
		ans += a[i] * b[i];
	}
	
	cout<<ans.val()<<endl;
	
	return 0;
	
}
0