11934 - Magic Formula

All about problems in Volume 119. 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
receme
New poster
Posts: 17
Joined: Thu Jul 01, 2010 11:55 am

11934 - Magic Formula

Post by receme » 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.

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

Re: 11934 - Magic Formula

Post by helloneo » 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..

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

Re: 11934 - Magic Formula

Post by suneast » 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~ :D

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11934 - Magic Formula

Post by naseef_07cuet » Wed Mar 09, 2011 1:42 am

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

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

11934 - Magic Formula

Post by Psh » 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...
i Quit for a fresher start

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

Re: 11934 - Magic Formula

Post by plamplam » 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. :D
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

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

Re: 11934 - Magic Formula

Post by uDebug » 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. :D
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!

Find us on Facebook. Follow us on Twitter.

Post Reply

Return to “Volume 119 (11900-11999)”