比赛 不平凡的世界 评测结果 WWWWWWWWWW
题目名称 不平凡的boss 最终得分 0
用户昵称 StanTia 运行时间 2.734 s
代码语言 C++ 内存使用 0.28 MiB
提交时间 2015-11-05 10:16:27
显示代码纯文本
#include <iostream>
#include <cstdio>

using namespace std;

long long monster_num;

long long play_w = 0LL;
long long play_m = 0LL;
long long play_j = 0LL;

struct hit
{
	long long w;
	long long m;
	long long j;

	char state;

	hit(int a, int b, int c) :w(a), m(b), j(c){}
	hit(){}
	long long min(int a, int b)
	{
		return a<b ? a : b;
	}
	long long max(int a, int b)
	{
		return a>b ? a : b;
	}
	long long min()
	{
		if(w == m == j)
		{
			int max_num = max(play_w,max(play_m,play_j));
			if (max_num == play_w)
				state = 'w';
			if (max_num == play_m)
				state = 'm';
			if (max_num == play_j)
				state = 'j';
			return w;
		}
		int min_num = min(w, min(m, j));
		if (min_num == w)
			state = 'w';
		if (min_num == m)
			state = 'm';
		if (min_num == j)
			state = 'j';
		return min_num;
	}
};



int main()
{
	freopen("playwithboss.in","r",stdin);
	freopen("playwithboss.out","w",stdout);		
	
	hit* hits;
	cin >> monster_num;
	hits = new hit[monster_num];
	for (int i = 0; i<monster_num; i++)
	{
		int tmp_a, tmp_b, tmp_c;
		cin >> tmp_a >> tmp_b >> tmp_c;
		hits[i] = hit(tmp_a, tmp_b, tmp_c);
		hits[i].min();
		switch (hits[i].state)
		{
		case 'w':if (hits[i].w > play_w)
			play_w = hits[i].w;
			break;
		case 'm':if (hits[i].m > play_m)
			play_m = hits[i].m;
			break;
		case 'j':if (hits[i].j > play_j)
			play_j = hits[i].j;
			break;
		};
	}
	long long for_out = play_w + play_m + play_j;

	cout << for_out << endl;
	return 0;
}