11232 - Cylinder
Moderator: Board moderators
-
- New poster
- Posts: 9
- Joined: Sat Jul 07, 2007 5:47 pm
- Location: Denmark
11232 - Cylinder
Is it just me or is the answer for the second test input not optimal....
My binary search gives a radius of 6.036325 - not 5 as the statement says - and that gives a volume of 1144.709. I have checked whether this cylinder is legal and it seems so...
Is it a quirk in the problem statement i got wrong?
My binary search gives a radius of 6.036325 - not 5 as the statement says - and that gives a volume of 1144.709. I have checked whether this cylinder is legal and it seems so...
Is it a quirk in the problem statement i got wrong?
Randers FC l
-
- New poster
- Posts: 9
- Joined: Sat Jul 07, 2007 5:47 pm
- Location: Denmark
-
- New poster
- Posts: 9
- Joined: Sat Jul 07, 2007 5:47 pm
- Location: Denmark
I still get WA on this one....
I lean towards a precision error, but there might be a hidden bug somewhere.
Here is my code..
I lean towards a precision error, but there might be a hidden bug somewhere.
Here is my code..
Code: Select all
Acc
Last edited by David Kjaer on Sat Jul 07, 2007 9:55 pm, edited 1 time in total.
Randers FC l
I'd suggest to replace binary search by:
Code: Select all
my = min(width/2, len/(2*PI+2)).
-
- New poster
- Posts: 9
- Joined: Sat Jul 07, 2007 5:47 pm
- Location: Denmark
well .. I tried to solve it by counting both the volumes if the paper is folded
horizontally and vertically. Then, choose the biggest one.
Afterall, all of sudden just give me more Wrong Answers...
my code is actually simple. Just give me a hand please.
horizontally and vertically. Then, choose the biggest one.
Afterall, all of sudden just give me more Wrong Answers...
Actually, David, I have no idea why Binary Search used for...Is it just me or is the answer for the second test input not optimal....
My binary search gives a radius of 6.036325 - not 5 as the statement says - and that gives a volume of 1144.709. I have checked whether this cylinder is legal and it seems so...
Is it a quirk in the problem statement i got wrong?
my code is actually simple. Just give me a hand please.
Code: Select all
code removed
Last edited by dplt on Sun Jul 08, 2007 1:53 pm, edited 1 time in total.
-
- Experienced poster
- Posts: 111
- Joined: Mon Jan 09, 2006 6:19 pm
- Location: Tehran, Iran
- Contact:
i've got many WAs during the contest and after contest, can somebody tell me why my solution is wrong
here is my code:
here is my code:
Code: Select all
//removed
Last edited by arsalan_mousavian on Sun Jul 08, 2007 8:45 pm, edited 1 time in total.
In being unlucky I have the record.
-
- Guru
- Posts: 724
- Joined: Wed Dec 19, 2001 2:00 am
- Location: Germany
Why do you think your binary search should work?
You could use a ternary search, but actually only if you use two different ternary searches, one for the case with horizontal roll up, the other for vertical roll up. But I suggest you think more about this problem, then you can find a solution without any ternary search.
You could use a ternary search, but actually only if you use two different ternary searches, one for the case with horizontal roll up, the other for vertical roll up. But I suggest you think more about this problem, then you can find a solution without any ternary search.
-
- Experienced poster
- Posts: 122
- Joined: Sun Nov 13, 2005 10:25 am
- Location: Taiwan
here some random sample...may it helpfull...
input
output
GOOD LUCK
Rocky
input
Code: Select all
5 5
50 50
80 80
50 80
20 50
40 80
45 50
5 6
4 5
2 3
0 0
Code: Select all
6.781
6780.897
27774.554
14652.276
2289.418
11721.821
5748.996
8.770
4.745
0.824
Rocky
-
- Experienced poster
- Posts: 122
- Joined: Sun Nov 13, 2005 10:25 am
- Location: Taiwan
thanks.. but my outputs are same as yours..
I tried some other inputs, can someone check my outputs for me?
input
output
I tried some other inputs, can someone check my outputs for me?
input
Code: Select all
7 8
4 52
1 47
54 69
47 52
32 78
4 55
4 77
5 86
54 100
7 89
43 55
1 63
1 25
23 44
0 0
Code: Select all
22.506
50.265
0.785
12022.696
6511.038
8914.445
50.265
50.265
98.175
24725.716
269.392
6078.695
0.785
0.785
2038.864
Last edited by Wei-Ming Chen on Tue Jul 10, 2007 12:26 pm, edited 1 time in total.