ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Форумы > Обсуждение задач > тема:


Задача "50798 - Passing the course"

Идёт турнир!

В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.

Ani10.ноя.2015 в 20:48:19
0--- Test case 1 ---
20 72 74

--- Pattern---
Failed

imesecan21.ноя.2015 в 08:48:34
1When calculating averages you need to pay attention integer floating point operations. integer divided by integer does integer division operation. In integer division floating point part is omitted. For example in the expression:
float x;
x= 9 / 10;
x will be 0.

If you want to force to have floating point result, you need to typecast

float x;
x=(float)9/10;
x will be 0.9

imesecan29.ноя.2015 в 23:10:34
2If you use (float) in the beginning, it will not work:
A=(float)F*45/100 + M*35/100 + H*2/10;
as you can see the equation can be divided into three summation sections (multiplication and division operations have higher priority so, they are first calculated, then summations)

The second and third sections (M*35/100 + H*2/10) are integer operations. then the sums will be floating point. You should better use
A = F*0.45 + M*0.35 + H*0.2;


www.contester.ru