1419 - Function
Time Limit : 10 Second
Memory Limit : 128 MB
Believe me, short decription doesn’t always mean hard problem. Like the following one:
Let’s define two simple function D(x) and F(x)
D(x) is the digit sum of the number x: D(1) = 1, D(1203) = 6, D(99) = 18…
F(x) = x if x < 10
F(x) = F(D(x)) otherwise.
There are multiple cases.
The first line is an integer T representing the number of test cases.
The following T lines each line representing a test case. For each case there are exactly one line containing a single number X(0 < X < 1000000000).
For each test case, output a line containing the answer in the following format:
Case #K: T
K is the case number starting frome 1, and T equal to F(X).
- sample input
2 3 12
- sample output
Case #1: 3 Case #2: 3