Page 3 of 4

Posted: Wed Nov 30, 2005 10:09 pm
by nukeu666
bleh...finally got it accepted
the program works only with double
float gives the 3rd decimal place rounding off error
does this tell us double is more accurate than float? (even when talking about the 3rd decimal point?)

Posted: Wed Nov 30, 2005 10:58 pm
by mamun
nukeu666 wrote:does this tell us double is more accurate than float? (even when talking about the 3rd decimal point?)
That is how it is. Nowhere I've used float but double.

Posted: Sun Dec 25, 2005 10:51 am
by ayon
i still cannot understand the problem. from observation V=(W-2x)(L-2x)x. for V(max), x has only one value, it has no trouble. but for V(min), x = 0, W/2, L/2; so to determine V(min), i printed 3 values of x, while W != L, and 2 values of x, while W = L, and i got WA. then i checked the board and found that, the program is accepted only for 2 values of x; x = 0 and x = min(W,L)/2. but why not x = 0, min(W,L)/2 and max(W,L)/2, while W != L ?

Posted: Sun Dec 25, 2005 11:45 am
by mamun
Instead of telling min() or max(), let's consider L>W. Other than 0, W/2 is one answer, you understand. But if you cut L/2 along L axis do you get enough length along W axis to cut the same amount?

Posted: Sun Dec 25, 2005 5:29 pm
by ayon
i understand, thanks mamun. actually i was treating the problem only with the equation, not with its original visual body.

Rejudge

Posted: Mon Nov 27, 2006 8:27 pm
by DIR EN GREY
Rejudgement makes this problem very very difficult one. Now, accept rate is only 2.0%, of cource I got WA too :-(

http://acm.uva.es/p/problemstat.php?p=:10215

I checked the board, however, judges have just delete some tricky inputs.

http://online-judge.uva.es/board/viewtopic.php?t=12778

Why everybody got wa? I think if judges only delete inputs, programs which got accept first time should be accepted. So there must be some brandnew inputs.

Help! I need somebody, not just anybody but have got accept this time.

Here is my code.

Code: Select all

cut after got ac
Thanks in advance :D

Posted: Mon Nov 27, 2006 9:17 pm
by Jan
Add eps before printing anything. I used 1e-7. Hope it helps.

Posted: Tue Nov 28, 2006 12:23 am
by DIR EN GREY
Jan wrote:Add eps before printing anything. I used 1e-7. Hope it helps.
Thanks Jan!! I got accept immediately, but I can't understand that why I must use eps before printing? How eps works? I always use cout, setiosflags() and setprecision() when round off is required, and they works fine without EPS...

What input is crtical?? When I should use EPS??

thanks in advance :P

Posted: Tue Nov 28, 2006 2:13 am
by Jan
Imagine that the output is 1.05, but due to floating point calculation, your output became 1.049999999999. Now if you print only one digit after the decimal point your output is 1.0 but the real output is actually 1.1.
Thats why almost all problems that have floating point output are judged with a special judge program (marked by a yellow flag). But some problems dont have the special judge, for those problems its better to add eps before printing any floating point number. And eps should be as small as possible. Using 1e-7 to 1e-11 is sufficient.

Code: Select all

double a;
a=0.15;
printf("%.1lf\n",a);
The output will show .1, which is obviously not correct. But if you add eps before printing 'a', you will see .2, which is the correct output.

Posted: Wed Nov 29, 2006 3:23 am
by DIR EN GREY
Thanks Jan!! I understand this issue now. I didn't know purpose of the yellow mark.

Allow me to again thank you :D

Posted: Sun Dec 03, 2006 2:10 am
by fpavetic
i got this problem accepted by storing intermediate calculations in long double, and printing the result as double after many failed submissions.

PLEASE HELP!!!

Posted: Thu Jun 21, 2007 3:07 pm
by abhiramn

Code: Select all

CODE ACCEPTED!!!
Please tell me why this if giving WA :cry: :cry: :cry:
@Mr. Jan
max+=0.0000001 is that what you meant when you said add eps??? If not, please tell me what you meant. Thanks a lot.[[/b]

Posted: Mon Aug 20, 2007 6:58 am
by WingletE
:evil:
I got a lot of WA and finally got AC at once after changing COUT to printf...

Confused

Posted: Mon Sep 10, 2007 7:18 pm
by willima
I really didn't undertand why your code print 3 numbers as output for some inputs. My WA code printed the following for the last 3 cases of the first post:

Code: Select all

1666.500 0.000 4999.500
0.250 0.000 0.500 4999.500
0.250 0.000 0.500 4999.500
If the minimum volume is 0 and the volume is (L-2x)(M-2x)x, I got:
- L - 2x = 0;
- M - 2x = 0;
- x = 0.

Where is my mistake?

Thanks,

Willian.

why is my programm giving WA

Posted: Sun Feb 24, 2008 6:30 am
by fR0D
here's my code....it seems right but gives WA...also suggest me how to use eps???

Code: Select all

CODE Deleted after AC