結果
| 問題 |
No.41 貯金箱の溜息(EASY)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-05 14:24:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 606 bytes |
| コンパイル時間 | 462 ms |
| コンパイル使用メモリ | 63,112 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-23 08:27:06 |
| 合計ジャッジ時間 | 883 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
const long M_MAX = 1e10;
const int UNIT = 111111;
const int MOD = 1e9 + 9;
int main() {
int limit = M_MAX / UNIT;
vector<long long> dp(limit + 1, 1);
for (int coin = 1; coin <= 9; coin++) {
for (int i = coin; i <= limit; i++) {
dp[i] = (dp[i - coin] + dp[i]) % MOD;
}
}
int t;
long long m;
cin >> t;
vector<long> ans(t, 0);
for (int i = 0; i < t; i++) {
cin >> m;
ans[i] = dp[m / UNIT];
}
for (int i = 0; i < t; i++) {
cout << ans[i] << endl;
}
return 0;
}