Page 1 of 1

### 11687 - Digits

Posted: Wed Mar 26, 2014 1:45 pm
Here's some input / output that I found useful during testing / debugging.

What's not entirely clear to me is why the AC output for input "1" is "1". Shouldn't it be "2"?

Update: juniorAw, answered this question on uHunt and I'd like to share what I learned. Recall, from the problem statement that

Code: Select all

``x(i+1) = the number of digits in the decimal representation of xi ``
Let x0 = 1. Now,

Code: Select all

``x1 = x(0+1) = the number of digits in the decimal representation of x0 = 1. So, x0 = x1.``
Let's see what happens when x0's not equal to 1 but is less than 10.

Assume x0 = 2. Now,

Code: Select all

``````
x1 = x(0+1) = the number of digits in the decimal representation of x0 = 1. So, x0 != x1.

x2 = x(1+1) = the number of digits in the decimal representation of x1 = 1. So, x1 = x2.``````
Input:

Code: Select all

``````1
2
3
4
5
6
7
8
9
43
674
8394394390224254424242342324
888888888888888888888888888888232323289238923892389238923892389238923892
999999999999999999999999999999999999999999999992392392392392392923923923923923923923923923923923923923923333333333333333333333
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999943535353535935999999999999999999999999999999999999999999993454353535354353593999
END``````
AC Output:

Code: Select all

``````1
2
2
2
2
2
2
2
2
3
3
4
4
4
4
``````

### Re: 11687 - Digits

Posted: Sun Nov 30, 2014 6:45 pm
I am getting WA. whats wrong with my code?

Code: Select all

``````Accepted !
``````

### Re: 11687 - Digits

Posted: Sun Nov 30, 2014 7:02 pm

Input

Code: Select all

``````1
END``````
Acc Output

Code: Select all

``````1
``````

### Re: 11687 - Digits

Posted: Sun Nov 30, 2014 7:25 pm
Did you run my code? My code also giving output 1 for input 1.

Give any other cases, for which my code is failed to give correct output...

### Re: 11687 - Digits

Posted: Sun Nov 30, 2014 7:29 pm
Check the code you posted, not the code on your pc. http://ideone.com/ebpEfP

### Re: 11687 - Digits

Posted: Sun Nov 30, 2014 7:51 pm
Oh.. I am sorry.. It was just copy-paste problem.
With the code on my pc I got Accepted !