Submission #15670

#TimeUsernameProblemLanguageResultExecution timeMemory
15670onemonster님 무기가 좀 나쁘시네여 (kriii3_S)C++98
0 / 29
0 ms1720 KiB
#include <iostream> using namespace std; int min(int value,int percentlimit) { int limit=percentlimit*100; if(value>limit) { return limit; } else { return value; } } void Compare(int init,int latter) { if(init>latter) { cout<<'-'; } else if(init<latter) { cout<<'+'; } else { cout<<'0'; } } class Weapon { public: int Attack; int Power; int CritChance; int CritDamage; int AttackSpeed; int BattleScore; Weapon(int Atk,int Pwr,int CrtChc,int CD,int AtkSpd) { Attack=Atk; Power=Pwr; CritChance=CrtChc; CritDamage=CD; AttackSpeed=AtkSpd; } }; class Player { private: int Attack; int Power; int CritChance; int CritDamage; int AttackSpeed; int BattleScore; bool isEquiped=true; public: Player(int Atk,int Pwr,int CrtChc,int CD,int AtkSpd) { Attack=Atk; Power=Pwr; CritChance=CrtChc; CritDamage=CD; AttackSpeed=AtkSpd; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } void Equip(Weapon weapon) { isEquiped=true; Attack+=weapon.Attack; Power+=weapon.Power; CritChance+=weapon.CritChance; CritDamage+=weapon.CritDamage; AttackSpeed+=weapon.AttackSpeed; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } void deEquip(Weapon weapon) { isEquiped=false; Attack-=weapon.Attack; Power-=weapon.Power; CritChance-=weapon.CritChance; CritDamage-=weapon.CritDamage; AttackSpeed-=weapon.AttackSpeed; BattleScore=Attack*(1+Power/100)*((1-min(CritChance,1))+min(CritChance,1)*CritDamage)*(1+AttackSpeed); } int GetBattleScore(void) { return BattleScore; } void ShowBattleScore(void) { cout<<BattleScore; } }; int main(void) { int a[20]; for(int i=0;i<20;i++) { cin>>a[i]; } Player Cree(a[0],a[1],a[2],a[3],a[4]);//Cree with weapon Player Paboo(a[5],a[6],a[7],a[8],a[9]);//Paboo with weapon Weapon CreeWeapon(a[10],a[11],a[12],a[13],a[14]); Weapon PabooWeapon(a[15],a[16],a[17],a[18],a[19]); int InitCreeBattleScore=Cree.GetBattleScore(); int InitPabooBattleScore=Paboo.GetBattleScore(); Cree.deEquip(CreeWeapon); Cree.Equip(PabooWeapon); Paboo.deEquip(PabooWeapon); Paboo.Equip(CreeWeapon); Compare(InitCreeBattleScore,Cree.GetBattleScore()); cout<<endl; Compare(InitPabooBattleScore,Paboo.GetBattleScore()); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...