結果
| 問題 |
No.41 貯金箱の溜息(EASY)
|
| コンテスト | |
| ユーザー |
izuru_matsuura
|
| 提出日時 | 2017-10-31 18:11:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,237 bytes |
| コンパイル時間 | 1,616 ms |
| コンパイル使用メモリ | 167,948 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 11:08:43 |
| 合計ジャッジ時間 | 7,645 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
namespace {
typedef long long ll;
ll T;
ll M;
void solve();
void doit() {
cin >> T;
for (auto i = 0; i < T; i++) {
cin >> M;
solve();
}
}
/** output whole vector. ex) vector<int>{1, 2, 3} -> '1 2 3'. */
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& xs) {
if (xs.empty()) return os;
os << xs[0];
for (auto i = 1; i < xs.size(); i++) os << ' ' << xs[i];
return os;
}
void solve() {
const ll unit = 111*1000 + 111;
const ll MOD = ll(1e9 + 9);
auto m = M / unit;
vector<ll> g(m + 1, 1);
for (auto k = 1; k <= 9; k++) {
for (auto x = 0; x <= m; x++) {
if (x - k >= 0) {
g[x] += g[x - k];
if (g[x] >= MOD) g[x] -= MOD;
}
//g[x][k] = 0;
//for (auto t = 0; t * k <= x; t++) {
// g[x][k] = (g[x][k] + g[x - t * k][k - 1]) % MOD;
//}
}
}
ll ans = g[m];
cout << ans << endl;
}
}
int main() {
doit();
return 0;
}
izuru_matsuura