No.3628 Sum of Superfibonacci Numbers
Problem Statement
A positive integer $n$ is called a good number if $n$ satisfies the following condition.
- When $n$ is interpreted as a decimal number, let $n_i$ be the value of its $10^i$ place. There exists a non-negative integer $i$ such that $n_{i+2} > n_{i+1} + n_i$.
For a positive integer $n$, define $f(n)$ as the minimum good number greater than or equal to $n$.
You are given a positive integer $N$. Find the value of $f(1) + f(2) + \cdots + f(N)$ modulo $998244353$.
$T$ test cases are given; answer each of them.
Constraints
- All input values are integers.
- $1 \leq T \leq 200$
- $1 \leq N \leq 10^{18}$
Input
The input is given from standard input in the following format.
$T$
$\mathrm{case}_1$
$\mathrm{case}_2$
$\vdots$
$\mathrm{case}_T$
Each test case is given in the following format.
$N$
Output
Output the answers to the test cases in order, separated by newlines.
Sample
Sample 1
Input
4 10 668 169231 1000000000000000000
Output
1000 245820 346334860 992299114
The good numbers in ascending order are $100, 200, 201, 210, 300, 301, 302, 310, 311, 320, 400, \cdots$.
For the $1$-st test case, for every $k = 1, 2, \cdots, 10$, the smallest good number greater than or equal to $k$ is $100$, so the answer is $100 \times 10 = 1000$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
ぽえ
kazuppa