結果
問題 |
No.189 SUPER HAPPY DAY
|
ユーザー |
![]() |
提出日時 | 2015-04-22 00:46:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,415 bytes |
コンパイル時間 | 1,001 ms |
コンパイル使用メモリ | 97,168 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 22:40:13 |
合計ジャッジ時間 | 3,071 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 20 |
ソースコード
#define _USE_MATH_DEFINES #include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstring> #include <cmath> #include <fstream> #include <map> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<ll, int> ll_i; typedef pair<double, int> d_i; typedef pair<ll, ll> ll_ll; typedef pair<double, double> d_d; struct edge { int u, v; ll w; }; ll MOD = 1000000009; ll _MOD = 1000000009; double EPS = 1e-10; vector<int> f(string s, vector<vector<int> >& dp) { vector<int> a(2000); int sum = 0; for (int i = 0; i < s.length(); i++) { for (int d = 0; d < s[i] - '0'; d++) for (int x = sum; x + d < 2000; x++) a[x + d] = (a[x + d] + dp[s.length() - i - 1][x]) % MOD; sum += s[i] - '0'; } a[sum]++; return a; } int main() { vector<vector<int> > dp(201, vector<int>(2000)); dp[0][0] = 1; for (int i = 0; i + 1 <= 200; i++) for (int d = 0; d < 10; d++) for (int x = 0; x + d < 2000; x++) dp[i + 1][x + d] = (dp[i + 1][x + d] + dp[i][x]) % MOD; string M, D; cin >> M >> D; vector<int> m = f(M, dp), d = f(D, dp); int ans = 0; for (int x = 1; x < 2000; x++) ans = (ans + (ll)m[x] * d[x]) % MOD; cout << ans << endl; }