10929 - You can say 11

All about problems in Volume 109. 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: 10929 - You can say 11

Post by brianfry713 »

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

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

Re: 10929 - You can say 11

Post by uDebug »

jddantes wrote:Why is mine not accepted?
Did you mean for this line

Code: Select all

for(i=0; number[i];i++)
to be

Code: Select all

for(i=0;i<number[i];i++)
?
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

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

Re: 10929 - You can say 11

Post by brianfry713 »

v1n1t, no he didn't.

The code jddantes posted is AC.
Check input and AC output for thousands of problems on uDebug!

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

Re: 10929 - You can say 11

Post by uDebug »

brianfry713 wrote:v1n1t, no he didn't.
Gotcha. Thanks for the clarification.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

ehsanulbigboss
New poster
Posts: 32
Joined: Tue Jul 22, 2014 1:17 am

10929 - You can say 11

Post by ehsanulbigboss »

:D
Last edited by ehsanulbigboss on Thu Feb 05, 2015 10:05 pm, edited 1 time in total.

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

Re: 10929 - You can say 11

Post by lighted »

Code: Select all

Use code tags. Like this
My advice to you -> always copy/paste output format from sample or problem description. :)

Your output

Code: Select all

5038297 is multiple of 11.
112234 is not multiple of 11.
Sample output

Code: Select all

5038297 is a multiple of 11.
112234 is not a multiple of 11.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Helaluddin_brur
New poster
Posts: 15
Joined: Tue Oct 21, 2014 4:08 pm
Location: Bangladesh
Contact:

Re: 10929 - You can say 11

Post by Helaluddin_brur »

removed after accepted
lighted wrote:
Your function call_div is not correct. Since it is a function it should return a value. There is no return command.
Thank's a lot guru
Last edited by Helaluddin_brur on Sat Dec 06, 2014 4:05 pm, edited 3 times in total.

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

Re: 10929 - You can say 11

Post by lighted »

Your code fails last case (112234). Also change line to

Code: Select all

printf("%d", fir[i]-'0');
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

Helaluddin_brur
New poster
Posts: 15
Joined: Tue Oct 21, 2014 4:08 pm
Location: Bangladesh
Contact:

Re: 10929 - You can say 11

Post by Helaluddin_brur »

lighted wrote:
Your code fails last case (112234)
after changing printf("%lld", fir-'0'); to printf("%d", fir-'0');
for input

Code: Select all

112234

my output is

Code: Select all

112234 is not a multiple of 11.
but what is wrong here?

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

Re: 10929 - You can say 11

Post by lighted »

Your code always prints that number is a multiple. http://ideone.com/oX6urL

Your function call_div is not correct. Since it is a function it should return a value. There is no return command. Or you should make it void function and pass parameter res by reference.

Code: Select all

void call_div(char *number, long long int div, long long int &res)
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 109 (10900-10999)”