11001  Necklace
Moderator: Board moderators

 New poster
 Posts: 21
 Joined: Tue Jan 10, 2006 12:25 am
11001  Necklace
What does unique mean in this problem
 little joey
 Guru
 Posts: 1080
 Joined: Thu Dec 19, 2002 7:37 pm
If you have Vtotal=6 and V0=2, you can either make one disk with diameter 0.3*sqrt(62) = 0.6, or two disks with diameter 0.3*sqrt(32) = 0.3. Both necklaces have the same length (0.6) and therefor the answer is not unique.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
Need help! This is what I tried:
What am I missing?
Code: Select all
[1] L = n * D = 0.3 * n * sqrt( Vtot/n  V0 )
[2] L' = 0 && L'' < 0 or so on ...
 little joey
 Guru
 Posts: 1080
 Joined: Thu Dec 19, 2002 7:37 pm
Nothing much, I think. The function L(n) is well behaved and has real values between it's two zeros n=0 and n=Vtot/Vo, and one maximum, so there is no need to consider the second derivative. Are you sure you don't report a value outside this range where L(n) becomes imaginary?
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
Thanks!
having a WA with this one, I well ... trashed the 20odd lines.
Hope my previous post isn't a spoiler. Realized it only now
Well, I no longer have a way to check it, offhand. I was so pissed off withlittle joey wrote:... Are you sure you don't report a value outside this range where L(n) becomes imaginary?
having a WA with this one, I well ... trashed the 20odd lines.
Hope my previous post isn't a spoiler. Realized it only now

 New poster
 Posts: 21
 Joined: Tue Jan 10, 2006 12:25 am
Hello there!
I'm getting WA. Could anyone say me why?
Sorry for post my code
I'm getting WA. Could anyone say me why?
Sorry for post my code
Code: Select all
EDITED POST
Last edited by Emilio on Sat Mar 11, 2006 4:28 am, edited 2 times in total.
Here are some tests:
btw, it's possible to solve this problem without floating point computations.
Code: Select all
10 4
10 5
100 50
100 51
60000 600
60000 500
60000 300
42424 543
0 0
Code: Select all
1
1
1
1
50
60
100
39
thanks for your test cases, I have maked some changes and now get correct answer for your test cases but continue getting WA.
Here is my new code (sorry for posting)
Where is my mistake please?
btw, I will try figure out how solve this problem without floating point computations
Here is my new code (sorry for posting)
Code: Select all
CUT OFF
btw, I will try figure out how solve this problem without floating point computations
Last edited by Emilio on Sat Mar 11, 2006 2:11 pm, edited 1 time in total.

 New poster
 Posts: 1
 Joined: Tue Mar 28, 2006 6:06 pm
for the input:
output:
Darko
Code: Select all
40000 3
40000 9
50000 3
60000 7
60000 9
60000 11
0 0
Code: Select all
6667
2222
8333
4286
3333
2727