排序 最大俩个数 相加。。剩下最大的三个数相加 判断下就可以了
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int const MAXN = 100;
int const n = 6;
int m[MAXN];
int main(){
int t;
while(~scanf("%d",&t)){
while(t--){
for(int i = 1;i <= n;i++){
scanf("%d",&m[i]);
}
sort(m+1,m+n+1);
int s1 = 0,s2 = 0;
s1 = m[n]+ m[n - 1];
s2 = m[n-2]+m[n - 3]+m[n-4];
if(s1 <= s2)printf("What a sad story!\n");
else printf("Grandpa Shawn is the Winner!\n");
}
}
return 0;
}