結果
| 問題 | No.41 貯金箱の溜息(EASY) |
| コンテスト | |
| ユーザー |
ふーらくたる
|
| 提出日時 | 2016-08-05 19:30:09 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,662 ms / 5,000 ms |
| コード長 | 774 bytes |
| 記録 | |
| コンパイル時間 | 566 ms |
| コンパイル使用メモリ | 77,560 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-07 06:46:13 |
| 合計ジャッジ時間 | 3,309 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
typedef long long ll;
const ll MOD = 1000 * 1000 * 1000 + 9;
const ll MAX_M = 10000000000LL;
const auto PRICE1 = 111111;
int main() {
int T;
cin >> T;
static vector<ll> dp(MAX_M / PRICE1 + 1, 0);
dp[0] = 1;
for (auto price = 1; price <= 9; price++) {
for (auto use = 0; use < dp.size(); use++) {
if (use - price < 0) continue;
dp[use] += dp[use - price];
dp[use] %= MOD;
}
}
while (T--) {
ll M;
cin >> M;
ll ans = 0;
for (auto use = 0; use <= M / PRICE1; use++) {
ans += dp[use];
ans %= MOD;
}
cout << ans << endl;
}
return 0;
}
ふーらくたる