640 - Self Numbers

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

Moderator: Board moderators

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 640 - Self Numbers

Post by brianfry713 » Wed Sep 03, 2014 7:40 pm

Check input and AC output for thousands of problems on uDebug!

nahin.ruet12
New poster
Posts: 5
Joined: Fri Aug 02, 2013 1:26 pm

Re: 640 - Self Numbers

Post by nahin.ruet12 » Fri Sep 19, 2014 9:00 pm

My program gives Run Time error...but my program gives expected output in my compiler...i can't detect any error in my code...plz help me... :(

Code: Select all

 Accepted
Thanks :lol:
Last edited by nahin.ruet12 on Sat Sep 20, 2014 7:19 pm, edited 1 time in total.

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 640 - Self Numbers

Post by lighted » Sat Sep 20, 2014 11:38 am

Change your code

Code: Select all

        while(num<=1000000)
        {
            sum=0;

            sum=num+digitSum(num);

            num=sum;

            if(selfNumbers[num]==1)
                break;
            else
                selfNumbers[num]=1;
        }
Don't forget to remove your code after getting accepted. 8)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Post Reply

Return to “Volume 6 (600-699)”