10929 - You can say 11
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10929 - You can say 11
That is AC code
Check input and AC output for thousands of problems on uDebug!
Re: 10929 - You can say 11
Did you mean for this linejddantes wrote:Why is mine not accepted?
Code: Select all
for(i=0; number[i];i++)
Code: Select all
for(i=0;i<number[i];i++)
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10929 - You can say 11
v1n1t, no he didn't.
The code jddantes posted is AC.
The code jddantes posted is AC.
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 32
- Joined: Tue Jul 22, 2014 1:17 am
10929 - You can say 11

Last edited by ehsanulbigboss on Thu Feb 05, 2015 10:05 pm, edited 1 time in total.
Re: 10929 - You can say 11
Code: Select all
Use code tags. Like this

Your output
Code: Select all
5038297 is multiple of 11.
112234 is not multiple of 11.
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
-
- New poster
- Posts: 15
- Joined: Tue Oct 21, 2014 4:08 pm
- Location: Bangladesh
- Contact:
Re: 10929 - You can say 11
removed after accepted
Thank's a lot gurulighted wrote:
Your function call_div is not correct. Since it is a function it should return a value. There is no return command.
Last edited by Helaluddin_brur on Sat Dec 06, 2014 4:05 pm, edited 3 times in total.
Re: 10929 - You can say 11
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
-
- New poster
- Posts: 15
- Joined: Tue Oct 21, 2014 4:08 pm
- Location: Bangladesh
- Contact:
Re: 10929 - You can say 11
after changing printf("%lld", fir-'0'); to printf("%d", fir-'0');lighted wrote:
Your code fails last case (112234)
for input
Code: Select all
112234
my output is
Code: Select all
112234 is not a multiple of 11.
Re: 10929 - You can say 11
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.
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