#include <stdio.h>
#include <memory.h>
#define calc_expr(si, var) s[si].var = (c[si].var - s[si].var) < 0 ? 0 : (c[si].var - s[si].var)
#define calc_expr2(si, di, var) s[di].var = (s[si].var + s[di].var) < 0 ? 0 : (s[si].var + s[di].var)
double min(double a, double b)
{
return (a > b) ? b : a;
}
typedef struct Status {
int atk;
int str;
int crit_rate;
int crit_damage;
int speed;
}Status;
double get_power(Status *s)
{
return s->atk * ( 1 + (s->str / 100.0) ) * ((1 - min(s->crit_rate/100.0, 1)) + min(s->crit_rate/100.0, 1) * s->crit_damage/100.0) * (1 + s->speed/100.0);
}
void get_result(Status *b, Status *a)
{
double before = get_power(b), after = get_power(a);
if ( before < after )
printf("+\n");
else if ( before > after )
printf("-\n");
else
printf("0\n");
}
int main()
{
Status c[2], s[4];
int i;
for ( i = 0; i < 2; i++ )
scanf("%d %d %d %d %d", &c[i].atk, &c[i].str, &c[i].crit_rate, &c[i].crit_damage, &c[i].speed);
for ( i = 0; i < 2; i++ ) {
scanf("%d %d %d %d %d", &s[i].atk, &s[i].str, &s[i].crit_rate, &s[i].crit_damage, &s[i].speed);
memcpy(s+3-i, s+i, sizeof(Status));
}
for ( i = 0; i < 2; i++ ) {
calc_expr(i, atk);
calc_expr(i, str);
calc_expr(i, crit_rate);
calc_expr(i, crit_damage);
calc_expr(i, speed);
}
for ( i = 2; i < 4; i++ )
{
calc_expr2(i-2, i, atk);
calc_expr2(i-2, i, str);
calc_expr2(i-2, i, crit_rate);
calc_expr2(i-2, i, crit_damage);
calc_expr2(i-2, i, speed);
}
get_result(c+0, s+2);
get_result(c+1, s+3);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
0 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
0 ms |
1084 KB |
Output is correct |
12 |
Correct |
0 ms |
1084 KB |
Output is correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
0 ms |
1084 KB |
Output is correct |
16 |
Correct |
0 ms |
1084 KB |
Output is correct |
17 |
Correct |
0 ms |
1084 KB |
Output is correct |
18 |
Correct |
0 ms |
1084 KB |
Output is correct |
19 |
Correct |
0 ms |
1084 KB |
Output is correct |
20 |
Correct |
0 ms |
1084 KB |
Output is correct |
21 |
Correct |
0 ms |
1084 KB |
Output is correct |
22 |
Correct |
0 ms |
1084 KB |
Output is correct |
23 |
Correct |
0 ms |
1084 KB |
Output is correct |
24 |
Correct |
0 ms |
1084 KB |
Output is correct |
25 |
Correct |
0 ms |
1084 KB |
Output is correct |
26 |
Correct |
0 ms |
1084 KB |
Output is correct |
27 |
Correct |
0 ms |
1084 KB |
Output is correct |
28 |
Correct |
0 ms |
1084 KB |
Output is correct |
29 |
Correct |
0 ms |
1084 KB |
Output is correct |
30 |
Correct |
0 ms |
1084 KB |
Output is correct |
31 |
Correct |
0 ms |
1084 KB |
Output is correct |
32 |
Correct |
0 ms |
1084 KB |
Output is correct |
33 |
Correct |
0 ms |
1084 KB |
Output is correct |
34 |
Correct |
0 ms |
1084 KB |
Output is correct |
35 |
Correct |
0 ms |
1084 KB |
Output is correct |
36 |
Correct |
0 ms |
1084 KB |
Output is correct |
37 |
Correct |
0 ms |
1084 KB |
Output is correct |
38 |
Correct |
0 ms |
1084 KB |
Output is correct |
39 |
Correct |
0 ms |
1084 KB |
Output is correct |
40 |
Correct |
0 ms |
1084 KB |
Output is correct |
41 |
Correct |
0 ms |
1084 KB |
Output is correct |
42 |
Correct |
0 ms |
1084 KB |
Output is correct |
43 |
Correct |
0 ms |
1084 KB |
Output is correct |
44 |
Correct |
0 ms |
1084 KB |
Output is correct |
45 |
Correct |
0 ms |
1084 KB |
Output is correct |
46 |
Correct |
0 ms |
1084 KB |
Output is correct |