Page 1 of 1
11879 - Multiple of 17
Posted: Thu Jan 23, 2014 2:29 pm
by nahin.ruet12
i can't understand the logic of this problem....given logic in problem may be not appropriate to solve the problem....please help me...!!!
Re: 11879 - Multiple of 17
Posted: Thu Jan 23, 2014 10:08 pm
by brianfry713
http://en.wikipedia.org/wiki/Divisibility_rule
You can also just use Java's BigInteger or make your own C++ bigint functions.
Re: 11879 - Multiple of 17
Posted: Wed Mar 05, 2014 3:39 pm
by uDebug
Replying to follow the thread.
Re: 11879 - Multiple of 17
Posted: Tue Dec 16, 2014 6:00 pm
by gautamzero
why WA??
please give me some input ..
Re: 11879 - Multiple of 17
Posted: Tue Dec 16, 2014 9:56 pm
by brianfry713
Read this thread, try solving it without using floating point.
Re: 11879 - Multiple of 17
Posted: Sun Dec 21, 2014 12:16 pm
by lighted
Be careful with floating point. Change line to
Code: Select all
a += (n[i] - '0') * (pow(k,j) + 1e-8);
You could do something like
Code: Select all
char number[102];
..
for (rem = i = 0; number[i]; i++) rem = (rem * 10 + number[i] - '0') % 17;