結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー masamasa
提出日時 2015-02-05 14:24:39
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 1,233 ms
使用メモリ 4,904 KB
最終ジャッジ日時 2023-01-20 20:28:32
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 20 ms
4,904 KB
testcase_01 AC 20 ms
4,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0