結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー snrnsidysnrnsidy
提出日時 2021-09-08 01:02:18
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 536 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 198,528 KB
実行使用メモリ 10,592 KB
最終ジャッジ日時 2023-08-25 19:52:26
合計ジャッジ時間 2,979 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const long long int MOD = 1e9 + 9;
long long int dp[900010];

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	long long int N = 900009;

	dp[0] = 1;
	for(int i=0;i<10;i++)
	{
		int x = max(1,i);
		for(int j=0;j<=N;j++)
		{
			if(j + x > N) break;
			dp[j+x] += dp[j];
			dp[j+x]%=MOD;
		}
	}

	int tc;

	cin >> tc;

	while(tc--)
	{
		long long int n;
		cin >> n;

		if(n < 111111)
		{
			cout << 1 << '\n';
		}
		else
		{
			cout << dp[n/111111] << '\n';
		}
	}
	return 0;
}
0