11879 - Multiple of 17

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

Moderator: Board moderators

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

11879 - Multiple of 17

Post 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...!!! :roll:
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11879 - Multiple of 17

Post by brianfry713 »

http://en.wikipedia.org/wiki/Divisibility_rule

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!
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11879 - Multiple of 17

Post by uDebug »

Replying to follow the thread.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
gautamzero
New poster
Posts: 32
Joined: Fri Oct 10, 2014 1:10 pm
Location: Sylhet, Bangladesh

Re: 11879 - Multiple of 17

Post by gautamzero »

why WA?? :(
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..
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11879 - Multiple of 17

Post by brianfry713 »

Read this thread, try solving it without using floating point.
Check input and AC output for thousands of problems on uDebug!
lighted
Guru
Posts: 587
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

Re: 11879 - Multiple of 17

Post 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;
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 118 (11800-11899)”