結果

問題 No.189 SUPER HAPPY DAY
ユーザー kotamanegikotamanegi
提出日時 2017-03-14 23:00:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,591 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 92,596 KB
実行使用メモリ 36,088 KB
最終ジャッジ日時 2023-09-12 12:23:38
合計ジャッジ時間 2,551 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,632 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,564 KB
testcase_03 WA -
testcase_04 AC 4 ms
5,908 KB
testcase_05 WA -
testcase_06 AC 4 ms
5,956 KB
testcase_07 WA -
testcase_08 AC 4 ms
6,044 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 22 ms
20,256 KB
testcase_24 AC 25 ms
21,464 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <time.h>
#include <random>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define LONG_INF 10000000000000000
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long plus_map[2][10000] = {};
long long dper[2][300][2][5000] = {};
int main() {
	string a, b;
	cin >> a >> b;
	for (int i = 0;i < 2;++i) {
		string m;
		if (i == 0) {
			m = a;
		}
		else m = b;
		dper[i][0][1][0] = 1;
		for (int q = 0;q < m.length();++q) {
			for (int j = 0;j < 4000;++j) {
				//どの数でも選べる
				for (int t = 0;t < 10;++t) {
					dper[i][q+1][0][t + j] += dper[i][q][0][j];
					dper[i][q+1][0][t + j] %= MAX_MOD;
				}
				//どの数でも選べない
				for (int t = 0;t < m[q] - '0';++t) {
					dper[i][q+1][0][t + j] += dper[i][q][1][j];
					dper[i][q+1][0][t + j] %= MAX_MOD;
				}
				dper[i][q+1][1][j + (m[q] - '0')] += dper[i][q][1][j];
				dper[i][q+1][1][j + (m[q] - '0')] %= MAX_MOD;
			}
		}
		for (int q = 1;q < 5000;++q) {
			plus_map[i][q] = dper[i][m.length()][0][q] + dper[i][m.length()][1][q];
		}
	}
	long long ans = 0;
	for (int i = 1;i < 5000;++i) {
		ans += plus_map[0][i] * plus_map[1][i];
		ans %= MAX_MOD;
	}
	cout << ans << endl;
	return 0;
}
0