#include <iostream>
#include <cmath>
using namespace std;
typedef struct State{
int damage;
int str;
double criRate;
double criDamage;
double attackSpeed;
}State;
void initState(State* state)
{
cin >> state->damage;
cin >> state->str;
cin >> state->criRate;
state->criRate /= 100.0f;
cin >> state->criDamage;
state->criDamage /= 100.0f;
cin >> state->attackSpeed;
state->attackSpeed /= 100.0f;
}
double min(double num, double max)
{
if (num > max)
return max;
return num;
}
double getFightingPower(State* state)
{
return (double)state->damage * (1 + (double)state->str / 100) * (((1.0 - min(state->criRate, 1.0)) + min(state->criRate, 1.0) * state->criDamage)) * (1.0 + state->attackSpeed);
}
double wapponInstall(State *user, State *wappon)
{
user->damage += wappon->damage;
user->str += wappon->str;
user->criRate += wappon->criRate;
user->criDamage += wappon->criDamage;
user->attackSpeed += wappon->attackSpeed;
return getFightingPower(user);
}
void wapponUninstall(State *user, State *wappon)
{
user->damage -= wappon->damage;
user->str -= wappon->str;
user->criRate -= wappon->criRate;
user->criDamage -= wappon->criDamage;
user->attackSpeed -= wappon->attackSpeed;
}
void pringResult(double *A)
{
if (A[0] > A[1])
{
cout << "-" << endl;
}
else if (A[0] < A[1])
{
cout << "+" << endl;
}
else
{
cout << "0" << endl;
}
}
int main(void)
{
State A;
State B;
State AWappon;
State BWappon;
double AFightingPower[2];
double BFightingPower[2];
initState(&A);
initState(&B);
initState(&AWappon);
initState(&BWappon);
AFightingPower[0] = getFightingPower(&A);
BFightingPower[0] = getFightingPower(&B);
wapponUninstall(&A, &AWappon);
wapponUninstall(&B, &BWappon);
AFightingPower[1] = wapponInstall(&A, &BWappon);
BFightingPower[1] = wapponInstall(&B, &AWappon);
pringResult(AFightingPower);
pringResult(BFightingPower);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1720 KB |
Output is correct |
2 |
Correct |
0 ms |
1720 KB |
Output is correct |
3 |
Incorrect |
0 ms |
1720 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |