結果
| 問題 |
No.41 貯金箱の溜息(EASY)
|
| コンテスト | |
| ユーザー |
ano184
|
| 提出日時 | 2014-10-18 03:04:01 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 178 ms / 5,000 ms |
| コード長 | 687 bytes |
| コンパイル時間 | 860 ms |
| コンパイル使用メモリ | 74,680 KB |
| 実行使用メモリ | 9,088 KB |
| 最終ジャッジ日時 | 2024-12-30 09:25:53 |
| 合計ジャッジ時間 | 1,765 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#define repf(x,from,to) for(int (x)=(from);(x)<(to);(x)++)
typedef long long ll;
using namespace std;
int main()
{
const ll MOD=1000000009, MMX=10000000000;
map<ll,ll> mp;
vector<int> su;
repf(i,1,10) su.push_back(111111*i);
mp[0]=1LL;mp[MMX*2]=0LL;
repf(i,0,9) for(auto& x: mp){
if(su[i]+x.first <= MMX) (mp[su[i]+x.first] += x.second) %=MOD;
}
ll w=0;
for(auto& x: mp){
(x.second += w)%=MOD;
w=x.second;
}
int T; cin >> T;
while( T--){
ll M; cin >> M;
auto it = mp.upper_bound(M); it--;
cout << it->second <<endl;
}
return 0;
}
ano184