## 11934 - Magic Formula

Moderator: Board moderators

receme
New poster
Posts: 17
Joined: Thu Jul 01, 2010 11:55 am

### 11934 - Magic Formula

what's wrong with this problem?? f (n) = a x 2 + b x + c .... here what should I think?? Is it b*x or 'x' is here for multiplication.If so....where is other variable?? Again..... test cases are also confusing. 3rd and 4th test case are same but answer is different. Plz...help. I got WA. I didn't participate in the contest. So i don't know if there was a clarification.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

### Re: 11934 - Magic Formula

Yes.. the description is confusing..
The formula is

f(x) = a*x*x + b*x + c

The sample out is also wrong..

suneast
New poster
Posts: 49
Joined: Sun Jan 17, 2010 6:25 am
Location: FZU
Contact:

### Re: 11934 - Magic Formula

receme wrote:what's wrong with this problem?? f (n) = a x 2 + b x + c .... here what should I think?? Is it b*x or 'x' is here for multiplication.If so....where is other variable?? Again..... test cases are also confusing. 3rd and 4th test case are same but answer is different. Plz...help. I got WA. I didn't participate in the contest. So i don't know if there was a clarification.
I think you can solve this problem using simple brute force.
the format is correct post above...

happy coding~

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm

### Re: 11934 - Magic Formula

It is quite ridiculous to have wrong sample i/o......
If you have determination, you can do anything you want....

Psh
New poster
Posts: 7
Joined: Tue Jul 06, 2010 9:52 pm
Contact:

### 11934 - Magic Formula

The function would be.. f(n) = an² + bn + c

Sample Input

0 0 10 5 100
0 0 10 6 100
1 2 3 4 5
1 2 3 3 5
0 0 0 0 0

Sample Output

101
0
0
4

3rd and 4th testcase are not the same...
i Quit for a fresher start

plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

### Re: 11934 - Magic Formula

I got Wrong Answer on my first attempt. I got AC after I changed my int variables to long long and I used the fmod function instead of the '%' operator. Don't know for which one it got AC.
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

### Re: 11934 - Magic Formula

naseef_07cuet wrote:It is quite ridiculous to have wrong sample i/o......
Maybe this was true back in 2011 but the sample input's correct now (in 2014).
plamplam wrote:I got Wrong Answer on my first attempt. I got AC after I changed my int variables to long long and I used the fmod function instead of the '%' operator. Don't know for which one it got AC.
Also, no such "black magic" going on. ints should be sufficient since the maximum and minimum ranges for f(x) are within 1,000,000,000.

That being said, here's some input / output I found useful during testing / debugging.

Input:

Code: Select all

``````999 999 999 9 999
283 431 744 2 433
11 65 77 11 389
-999 -999 -999 1000000 987
0 0 0 0 0
``````
AC Output:

Code: Select all

``````1000
434
36
0
``````
Check input and AC output for over 7,500 problems on uDebug!