Page 1 of 1

### 11934 - Magic Formula

Posted: Sun Feb 27, 2011 7:19 am
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.

### Re: 11934 - Magic Formula

Posted: Sun Feb 27, 2011 1:28 pm
Yes.. the description is confusing..
The formula is

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

The sample out is also wrong..

### Re: 11934 - Magic Formula

Posted: Sun Feb 27, 2011 3:46 pm
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~

### Re: 11934 - Magic Formula

Posted: Wed Mar 09, 2011 1:42 am
It is quite ridiculous to have wrong sample i/o......

### 11934 - Magic Formula

Posted: Tue Mar 15, 2011 1:02 pm

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...

### Re: 11934 - Magic Formula

Posted: Sat Jun 18, 2011 8:52 pm
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.

### Re: 11934 - Magic Formula

Posted: Tue Jun 10, 2014 12:20 pm
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
``````