結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-09-08 01:02:18 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 36 ms / 5,000 ms | 
| コード長 | 536 bytes | 
| コンパイル時間 | 1,800 ms | 
| コンパイル使用メモリ | 193,396 KB | 
| 最終ジャッジ日時 | 2025-01-24 08:47:28 | 
| ジャッジサーバーID (参考情報) | judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
ソースコード
#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;
}
            
            
            
        