結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  IL_msta | 
| 提出日時 | 2015-07-22 15:15:01 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 17 ms / 5,000 ms | 
| コード長 | 1,170 bytes | 
| コンパイル時間 | 584 ms | 
| コンパイル使用メモリ | 85,168 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-07-08 11:47:32 | 
| 合計ジャッジ時間 | 1,043 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
ソースコード
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <iomanip>
 
#include <algorithm>
#include <cmath>
 
#include <string>
//#include <array>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
 
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
 
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
const int mod = 9+(int)1e9;
LL ans[10000];
const int dpmax = 100000;
LL dp[10][dpmax+1];
int main(void){
    std::cin.tie(0); 
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed;//
    //cout << setprecision(16);//
	int T;cin>>T;
	LL M;
	
	for(int i=0;i<=dpmax;++i){
		if(i-2>=0){
			dp[2][i] = (dp[2][i-2] + i + 1)%mod;
		}else{
			dp[2][i] = i + 1;
		}
	}
	for(int k=3;k<=9;++k)
	{
		for(int i=0;i<=dpmax;++i){
			if(i-k>=0){
				dp[k][i] = (dp[k][i-k] + dp[k-1][i])%mod;
			}else{
				dp[k][i] = dp[k-1][i];
			}
		}
	}
	
	rep(i,T){
		cin>>M;
		M /= 111111;
		ans[i] = dp[9][M];
	}
	rep(i,T){
		if(ans[i]){
			P(ans[i]);
		}else{
			P(1);
		}
	}
	
	return 0;
}
            
            
            
        