11687 - Digits

All about problems in Volume 116. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

11687 - Digits

Post by uDebug »

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
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am
Location: Rangpur, Bangladesh

Re: 11687 - Digits

Post by Shahidul.CSE »

I am getting WA. whats wrong with my code?

Code: Select all

Accepted !
Last edited by Shahidul.CSE on Sun Nov 30, 2014 7:51 pm, edited 1 time in total.
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11687 - Digits

Post by lighted »

You should read posts in this thread before posting

Input

Code: Select all

1
END
Acc Output

Code: Select all

1
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am
Location: Rangpur, Bangladesh

Re: 11687 - Digits

Post by Shahidul.CSE »

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...
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11687 - Digits

Post by lighted »

Check the code you posted, not the code on your pc. http://ideone.com/ebpEfP
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am
Location: Rangpur, Bangladesh

Re: 11687 - Digits

Post by Shahidul.CSE »

Oh.. I am sorry.. It was just copy-paste problem. :(
With the code on my pc I got Accepted ! :D
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
Post Reply

Return to “Volume 116 (11600-11699)”