10268 - 498'

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

Moderator: Board moderators

Re: 10268 - 498'

Postby Jehad Uddin » Sun Jul 04, 2010 10:49 am

Your input processing may be wrong.
Jehad Uddin
Learning poster
 
Posts: 74
Joined: Fri May 08, 2009 5:16 pm

Re: 10268 - 498'

Postby sazzadcsedu » Fri Aug 13, 2010 9:29 pm

At first look this problem seems very easy,But it is very tough to get Acc with the formula given in problem statement (At least for lots of people, i submitted a number of time using data type int/long long/double but couldn't get Acc ).So the best way is to use Horner's rule (I got Acc at first try) :D . Here is the Horner's rule-

Code: Select all
a_nx^n+a_(n-1)x^(n-1)+...+a_0=((a_nx+a_(n-1))x+...)x+a_0.



I think the stupid(not always :wink: ) pow() function is responsible for this.
sazzadcsedu
Experienced poster
 
Posts: 136
Joined: Sat Nov 29, 2008 8:01 am
Location: narayangong,bangladesh.

Re: 10268 - 498'

Postby plamplam » Mon Oct 03, 2011 2:14 pm

Ok this problem is really very annoying....a couple of tips if you are struggling to get Accepted.

This is very important...whatever you do don't use doubles or power functions. I even tried creating my own power functions which always returns integer value(I got accepted with this in other problems too) because I thought the built-in pow function caused precision error. It seems Horner's rule is the only way to solve this thing.....
btw int data type is fine...no need to use long long and no intermediate steps causes overflow too.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson
User avatar
plamplam
Experienced poster
 
Posts: 151
Joined: Fri May 06, 2011 11:37 am

Previous

Return to Volume CII

Who is online

Users browsing this forum: No registered users and 1 guest