結果
| 問題 | No.41 貯金箱の溜息(EASY) |
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-06-22 16:00:59 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 959 bytes |
| 記録 | |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 39,748 KB |
| 最終ジャッジ日時 | 2026-02-22 03:39:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
// yukicoder: No.41 貯金箱の溜息(EASY)
// 2019.6.22 bal4u
#include <stdio.h>
typedef long long ll;
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
ll in() { // 非負整数の入力
ll n = 0; int c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
void out(int n) { // 非負整数の表示(出力)
int i;
char b[20];
if (!n) pc('0');
else {
i = 0; while (n) b[i++] = n % 10 + '0', n /= 10;
while (i--) pc(b[i]);
}
pc('\n');
}
#define MOD 1000000009
#define LIM 90000
int dp[LIM+20];
int s[LIM+20];
int main()
{
int i, j, T, M;
for (i = 0; i <= LIM; i++) dp[i] = 1;
for (i = 2; i < 10; i++) {
for (j = 0; j <= LIM; j++) dp[j+i] = (dp[j+i] + dp[j]) % MOD;
}
for (i = 0; i <= LIM; i++) s[i+1] += (s[i] + dp[i]) % MOD;
T = (int)in();
while (T--) {
M = (int)(in() / 111111);
out(s[M+1]);
}
return 0;
}
bal4u