結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー masamasa
提出日時 2015-02-05 14:24:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 606 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 64,284 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-05 12:47:45
合計ジャッジ時間 899 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
4,376 KB
testcase_01 AC 22 ms
4,376 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