問題一覧 > 通常問題

No.41 The Piggy Bank's Sigh (EASY)

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 193
作問者 : LayCurse
お気に入りにしたユーザー ProblemId : 40 / 自分の提出
問題文最終更新日: 2026-06-25 06:42:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 39 (順位表) の他の問題:

Problem

Taro lives in the Land of Six-in-a-Row.
In this country, a total of \(10\) types of coins are used: the \(1\)-yen coin, plus coins whose values are repdigits made of \(6\) digits, that is, the \(111111\)-yen coin, the \(222222\)-yen coin, …, and the \(999999\)-yen coin.

Piggy Bank has saved up coins and saved up more, and now holds at least \(10^{20}\) coins of every type.
However, Taro wanted to go shopping for \(M\) yen.
Taro asked Piggy Bank to give him coins totaling exactly \(M\) yen.
Piggy Bank, reluctant to give away the coins he had worked so hard to save, decided to give them only if Taro could answer a question.
Piggy Bank asked, "What is the minimum number of coins I must hand over to give you \(M\) yen?", but Taro answered instantly.
So Piggy Bank switched to one more question: "How many ways are there for me to hand over coins to give you \(M\) yen?"
This time, Taro was stumped.
Write a program that finds the number of ways Piggy Bank can hand \(M\) yen to Taro, modulo \(10^9+9\).

Input

\(T\)
\(M_1\)
\(M_2\)
\(\vdots\)
\(M_T\)

\(1 \leq T \leq 10000\) denotes the number of test cases.
\(1 \leq M_k \leq 10^{10}\) denotes the value of \(M\) in each test case.

Output

On the \(k\)-th line of the output, print the number of ways Piggy Bank can hand \(M_k\) yen to Taro, modulo \(10^9+9\).

Sample

Sample 1
Input
7
1
111112
222222
10000000
100000000
1000000000
10000000000
Output
1
2
4
21312056
818664350
50564368
385490639

The only way to hand over \(1\) yen is to give \(1\) \(1\)-yen coin.
There are \(2\) ways to hand over \(111112\) yen: giving \(111112\) \(1\)-yen coins, or giving \(1\) \(111111\)-yen coin and \(1\) \(1\)-yen coin.
Note that \(10^{10}\) is greater than \(2^{32}\).

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。