ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1686. Photovoltaic Spaceship

WA#6
Posted by Sfairat 1 Mar 2009 21:22
I use such an algorithm:I take four normal vectors to four different surfaces of the "ship" as cross product of two vectors,which I take as two vectors between points creating these surfaces.The length of this vector is 2xsquare of the triangle created by these points.
Then,as energy produced by one surface of the "ship" for one star can be counted as square(sq further) of the surface multiplied by length of the "star" vector and multiplied by absolute of cos between normal vector to the surface and "star" vector.
abs of that cosinus is equal to abs of their scalar production divided by their length production.As sq*"star" vector length multiplied by 2 is equal to their length production,then the energy produced by one surface is equal to abs of their scalar production divided by 2.It's quite clear that if we sum energies produced by all surfaces we'll get 2x energy that's really got from this star,so we don't need to multiply it by 2 lately to get the power wished by "man in black".So,if we sum energies from all the stars we'll get resulting energy.
I have checked and rechecked this algorithm several times,I also have rechecked the program several times,but I Haven't found any mistakes not in the program,nor in the algorithm,I also ran several tests and checked the results manually,so I'll be grateful to anyone who'll show me possible mistakes.

Edited by author 01.03.2009 21:35
Re: WA#6
Posted by Laise 2 Mar 2009 20:30
To find answer we realy need to find sum of all scalar products of normals and star vectors (its absolute values of course), then divide 2 and print out...
I did it with long long - not int and not double
Re: WA#6
Posted by Sfairat 3 Mar 2009 16:12
I replaced int by long long and got the right result^_^ I have thought,for some reason,that int type'd be enough for summary power.