11879 - Multiple of 17
Moderator: Board moderators
-
- New poster
- Posts: 5
- Joined: Fri Aug 02, 2013 1:26 pm
11879 - Multiple of 17
i can't understand the logic of this problem....given logic in problem may be not appropriate to solve the problem....please help me...!!!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11879 - Multiple of 17
http://en.wikipedia.org/wiki/Divisibility_rule
You can also just use Java's BigInteger or make your own C++ bigint functions.
You can also just use Java's BigInteger or make your own C++ bigint functions.
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 32
- Joined: Fri Oct 10, 2014 1:10 pm
- Location: Sylhet, Bangladesh
Re: 11879 - Multiple of 17
why WA??
please give me some input ..
please give me some input ..
Code: Select all
removed
Last edited by gautamzero on Sun Dec 21, 2014 12:46 pm, edited 1 time in total.
None but a fool is always right..
so don't be upset when u r wrong..
so don't be upset when u r wrong..
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11879 - Multiple of 17
Read this thread, try solving it without using floating point.
Check input and AC output for thousands of problems on uDebug!
Re: 11879 - Multiple of 17
Be careful with floating point. Change line to
You could do something like
Code: Select all
a += (n[i] - '0') * (pow(k,j) + 1e-8);
Code: Select all
char number[102];
..
for (rem = i = 0; number[i]; i++) rem = (rem * 10 + number[i] - '0') % 17;
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman