HDU 4931 Happy Three Friends(水)

时间:2014-08-11 00:22:31   收藏:0   阅读:342

HDU 4931 Happy Three Friends

题目链接

题意:6个数字,一个取两个,妹子取三个,问最后谁会赢

思路:排个序,判断前两个和3 - 5个的和谁更大即可

代码:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int t, a[6];

int main() {
    scanf("%d", &t);
    while (t--) {
	for (int i = 0; i < 6; i++)
	    scanf("%d", &a[i]);
	sort(a, a + 6);
	int aa = a[5] + a[4];
	int bb = a[3] + a[2] + a[1];
	if (aa > bb) printf("Grandpa Shawn is the Winner!\n");
	else printf("What a sad story!\n");
    }
    return 0;
}


HDU 4931 Happy Three Friends(水),布布扣,bubuko.com

原文:http://blog.csdn.net/accelerator_/article/details/38477799

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!