# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15666 | onemonster | 님 무기가 좀 나쁘시네여 (kriii3_S) | C++98 | 0 ms | 0 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.
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)
{
if(Atk<0 || Atk>20000 || Pwr<0 || Pwr>20000 || CrtChc<0 || CrtChc>200 || CD<0 || CD>500 || AtkSpd <0 || AtkSpd>500)
{
cout<<"Could not initialize Player";
return;
}
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());
Compare(InitPabooBattleScore,Paboo.GetBattleScore());
return 0;
}