Submission #15418

#TimeUsernameProblemLanguageResultExecution timeMemory
15418ddaafftt님 무기가 좀 나쁘시네여 (kriii3_S)C++14
0 / 29
0 ms1720 KiB
#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 timeMemoryGrader output
Fetching results...