Jump to content

Something from the internet.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
Okay, i've been trying to solve this one for a day now.

The 2004 ACM Asia Programming Contest Dhaka, sponsored by IBM

I, myself, can program the program, that fits for the description and gives the stadium perimeter always 400m, but the biggest problem here is, that the example answers don't fit my answers, and they seem wrong ...

Example answer:
input:
5 : 4 

output:  length              width
Case 2: 107.2909560477 85.8327648381

Ok, let's test, if those parameters will make total stadium perimeter 400meters.

First, i'll find the ring radius, which is width/2 = 42.9m

That means ring perimeter is 2*PI*42.9m = 269m

now if i add 2*length to the perimeter it'll equal 107.29*2+269 = 483m, which is wrong because stadium perimeter must always be 400m. What the heck am i doing wrong??? Am i understanding the problem wrong, or what?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
First thing I noticed: it did NOT say that you are dealing with semi-circles on the ends.

However, if we assume semi-circles:
Second thing: P = pi*width + 2*length

Third: length/5 = width/4, so length = 5*width/4

You should be able to carry on from there.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts

WingedPanther said:

Second thing: P = pi*width + 2*length
Gives 483 as an answer... I tested this solution above.

WingedPanther said:

Third: length/5 = width/4, so length = 5*width/4
Yes, this is correct, and everything fits.

WingedPanther said:

First thing I noticed: it did NOT say that you are dealing with semi-circles on the ends.

Ok, lets say these are not semi circles. How is it even possible to know, how steep are the curves then? They could even be straight lines and stadium could be rectangle, because problem description doesn't say anything about how big was the original circle, the ends are part of.. (or how big are the slices)

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The diagram is NOT semicircles. It looks like the rectangle is circumscribed by a circle. That would make the diameter of the circle sqrt(l*l+w*w).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
Oh, thanks, i finally got it.

#6
Keith2009

Keith2009

    Newbie

  • Members
  • PipPip
  • 10 posts
thanks this helps me too.