# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15300 | wlgns88 | 님 무기가 좀 나쁘시네여 (kriii3_S) | C++98 | 0 ms | 1084 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |