-
Notifications
You must be signed in to change notification settings - Fork 0
/
564.c
35 lines (28 loc) · 757 Bytes
/
564.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* 2020 @gustavoguzzlima <[email protected]>
*/
#include <stdio.h>
#include <math.h>
int main()
{
double max_speed, current_driver_speed, penalty = 0.00;
scanf("%lf %lf", &max_speed, ¤t_driver_speed);
int points_lost = 0;
if (current_driver_speed > max_speed && fabs(current_driver_speed - max_speed * 1.2) <= 0.00001)
{
penalty += 85.13;
points_lost += 4;
}
else if (current_driver_speed > max_speed * 1.2 && current_driver_speed <= max_speed * 1.5)
{
penalty += 127.69;
points_lost += 5;
}
else if (current_driver_speed > max_speed * 1.5)
{
penalty += 574.62;
points_lost += 7;
}
printf("%.2lf\n%d\n", penalty, points_lost);
return 0;
}