結果

問題 No.189 SUPER HAPPY DAY
ユーザー kotatsugamekotatsugame
提出日時 2020-02-10 03:29:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 709 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 75,868 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-04-08 12:42:31
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 6 ms
6,676 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 7 ms
6,676 KB
testcase_04 AC 7 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
testcase_06 AC 7 ms
6,676 KB
testcase_07 AC 7 ms
6,676 KB
testcase_08 AC 6 ms
6,676 KB
testcase_09 AC 7 ms
6,676 KB
testcase_10 AC 6 ms
6,676 KB
testcase_11 AC 7 ms
6,676 KB
testcase_12 AC 7 ms
6,676 KB
testcase_13 AC 78 ms
7,424 KB
testcase_14 AC 100 ms
7,424 KB
testcase_15 AC 85 ms
8,960 KB
testcase_16 AC 88 ms
9,856 KB
testcase_17 AC 101 ms
9,472 KB
testcase_18 AC 82 ms
8,832 KB
testcase_19 AC 121 ms
8,448 KB
testcase_20 AC 47 ms
6,784 KB
testcase_21 AC 56 ms
6,676 KB
testcase_22 AC 16 ms
6,676 KB
testcase_23 AC 63 ms
9,984 KB
testcase_24 AC 62 ms
9,984 KB
testcase_25 AC 119 ms
9,728 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   27 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;
long mod=1e9+9;
vector<long>f(string s)
{
	vector<vector<vector<long> > >dp(s.size()+1,vector<vector<long> >(2,vector<long>(2000,0)));
	dp[0][0][0]=1;
	for(int i=0;i<s.size();i++)
	{
		for(int j=0;j<2;j++)
		{
			int lim=j?9:s[i]-'0';
			for(int k=0;k<2000;k++)
			{
				for(int l=0;l<=lim;l++)
				{
					if(k+l<2000)(dp[i+1][j||l<lim][k+l]+=dp[i][j][k])%=mod;
				}
			}
		}
	}
	vector<long>ret(2000,0);
	for(int i=0;i<2000;i++)ret[i]=(dp[s.size()][0][i]+dp[s.size()][1][i])%mod;
	return ret;
}
main()
{
	string m,d;cin>>m>>d;
	vector<long>A=f(m);
	vector<long>B=f(d);
	long ans=-1;
	for(int i=0;i<2000;i++)(ans+=A[i]*B[i])%=mod;
	cout<<ans<<endl;
}
0