# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15418 | ddaafftt | 님 무기가 좀 나쁘시네여 (kriii3_S) | C++14 | 0 ms | 1720 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 <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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |