ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1686. Фотоэлектрический звездолёт

Sfairat WA#6 [2] // Задача 1686. Фотоэлектрический звездолёт 1 мар 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
Laise Re: WA#6 [1] // Задача 1686. Фотоэлектрический звездолёт 2 мар 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
Sfairat Re: WA#6 // Задача 1686. Фотоэлектрический звездолёт 3 мар 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.