Solved by 69 users: ...
UserDateAttemptTimeCMSC
DAV`08 jun 2009`C++1500.01201
mishik`27 sep 2007`C++1600.01202
DAV`08 jun 2009`C++1300.01203
DAV`08 jun 2009`C++1400.01203
DAV`08 jun 2009`C++1200.01205
WsemirZ`06 aug 2008`C++800.01206
WsemirZ`06 aug 2008`C++700.01208
DAV`08 jun 2009`C++1000.01209
WsemirZ`06 aug 2008`C++500.01212
bush`21 mar 2006`Ruby100.02226
FordPerfect`15 apr 2005`FPC600.01230
mishik`27 sep 2007`C++1500.01245
dan`08 apr 2005`C100.01269
liulz`17 oct 2008`C++100.01276
mishik`27 sep 2007`C++1300.01277
svirg`28 sep 2007`C500.01285
m12sl`27 oct 2007`C++800.01288
svirg`28 sep 2007`C400.01305
mishik`27 sep 2007`C++1100.01312
mathematic`20 sep 2012`C++400.01315
 C++ 42 FPC 15 Kylix 8 C 3 Java 1 Ruby 1
` >  >  >  >  >  >  >  >  >  > `

## Fence

Time limit = 3 second(s)

There is an area bounded by a fence on some flat field. The fence has the height h and in the plane projection it has a form of a closed polygonal line (without self-intersections), which is specified by Cartesian coordinates (Xi, Yi) of its N vertices. At the point with coordinates (0, 0) a lamp stands on the field. The lamp may be located either outside or inside the fence, but not on its side as it is shown in the following sample pictures (parts shown in a thin line are not illuminated by the lamp):

The fence is perfectly black, i.e. it is neither reflecting, nor diffusing, nor letting the light through. Research and experiments showed that the following law expresses the intensity of light falling on an arbitrary illuminated point of this fence:
I0=k/r

where k is a known constant value not depending on the point in question, r is the distance between this point and the lamp in the plane projection. The illumination of an infinitesimal narrow vertical board with the width dl and the height h is:

dI=I0 · |cos A| · dl · h
where I0 is the intensity of light on that board of the fence, A is the angle in the plane projection between the normal to the side of the fence at this point and the direction to the lamp. You are to write a program that will find the total illumination of the fence that is defined as the sum of illuminations of all its illuminated boards.

Input The first line of the input file contains the numbers k, h and N, separated by spaces. k and h are real constants. N (3<=N<=100) is the number of vertices of the fence. Then N lines follow, every line contains two real numbers Xi and Yi, separated by a space.

Output Write to the output file the total illumination of the fence rounded to the second digit after the decimal point.

 Input#1```0.5 1.7 3 1.0 3.0 2.0 -1.0 -4.0 -1.0 ``` Output#1```5.34 ```
 Input#2```1.5 10.0 4 0.0 -3.0 3.5 2.0 0.0 4.0 1.0 0.0 ``` Output#2```47.12 ```

Author:
NEERC 1998 (http://neerc.ifmo.ru)

<PREV | Problem set | Search related messages | NEXT>

 © acm.mipt DevGroupThe page was generated in 190ms