Submission #15667

# Submission time Handle Problem Language Result Execution time Memory
15667 2015-07-14T08:00:48 Z onemonster 님 무기가 좀 나쁘시네여 (kriii3_S) C++
0 / 29
0 ms 1720 KB
#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<<'-'<<endl;;
    }
    else if(init<latter)
    {
        cout<<'+'<<endl;
    }
    else
    {
        cout<<'0'<<endl;;
    }
}

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());
    Compare(InitPabooBattleScore,Paboo.GetBattleScore());
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1720 KB Output isn't correct
2 Halted 0 ms 0 KB -