# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
15666 | onemonster | 님 무기가 좀 나쁘시네여 (kriii3_S) | C++98 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
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;
}