답안 #15216

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
15216 2015-07-12T04:02:07 Z yukariko 님 무기가 좀 나쁘시네여 (kriii3_S) C++
0 / 29
0 ms 1720 KB
#include <iostream>

using namespace std;

#define MY 0
#define CHANGE 1

float min(float n, float a)
{
	if (n > a)
		return a;
	return n;
}

class player
{
public:
	float atk, str, cri, cridmg, as;
public:
	player() : atk(0), str(0), cri(0), cridmg(0), as(0)
	{ }
	player(float a, float s, float c, float d, float speed) : atk(a), str(s), cri(c/100), cridmg(d), as(speed)
	{ }
	float power()
	{
		float p = atk*(1 + str / 100) * ( (1 - min(cri, 1.0)) + (min(cri, 1.0)*cridmg) )*(1 + as);
		return p;
	}
	player equip(float a, float s, float c, float d, float speed)
	{
		return player(a + atk, s + str, c + cri, d + cridmg, as + speed);
	}
	player unequip(float a, float s, float c, float d, float speed)
	{
		return player(atk-a, str-s, cri-c, cridmg-d, as-speed);
	}
};

int main()
{
	float atk, str, cri, cridmg, as;
	player kri[2], pabu[2];

	cin >> atk >> str >> cri >> cridmg >> as; 
	kri[MY]= player(atk, str, cri, cridmg, as);

	
	cin >> atk >> str >> cri >> cridmg >> as;
	pabu[MY] = player(atk, str, cri, cridmg, as);


	cin >> atk >> str >> cri >> cridmg >> as;
	kri[CHANGE] = kri[MY].unequip(atk, str, cri, cridmg, as);
	pabu[CHANGE] = pabu[MY].equip(atk, str, cri, cridmg, as); 
	cin >> atk >> str >> cri >> cridmg >> as;
	pabu[CHANGE] = pabu[CHANGE].unequip(atk, str, cri, cridmg, as);
	kri[CHANGE] = kri[CHANGE].equip(atk, str, cri, cridmg, as); 

	float kripower[2] = {}, pabupower[2] = {};
	
	kripower[0] = kri[MY].power();
	kripower[1] = kri[CHANGE].power();
	pabupower[0] = pabu[MY].power();
	pabupower[1] = pabu[CHANGE].power();

	if (kripower[0] < kripower[1])
		cout << '+' << endl;
	else if (kripower[0] == kripower[1])
		cout << '0' << endl;
	else
		cout << '-' << endl;
	if (pabupower[0] < pabupower[1])
		cout << '+' << endl;
	else if (pabupower[0] == pabupower[1])
		cout << '0' << endl;
	else
		cout << '-' << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1720 KB Output isn't correct
2 Halted 0 ms 0 KB -