Happy Three Friends

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

Problem Description
Dong-hao , Grandpa Shawn , Beautful-leg Mzry are good friends. One day , they want to play a game.

There are 6 numbers on the table.

Firstly , Dong-hao can change the order of 6 numbers.

Secondly , Grandpa Shawn take the first one and the last one , sum them up as his scores.

Thirdly , Beautiful-leg Mzry take any of 3 numbers from the last 4 numbers , and sum them up as his scores.

Finally , if Grandpa Shawn's score is larger than Beautiful-leg Mzry's , Granpa Shawn wins!

If Grandpa Shawn's score is smaller than Beautiful-leg Mzry's , Granpa Shawn loses.

If the scores are equal , there is a tie.

Nowadays , it's really sad that Grandpa Shawn loses his love. So Dong-hao wants him to win(not even tie). You have to tell Dong-hao whether he can achieve his goal.

 
Input
There is a number T shows there are T test cases below. ( T <= 50)

For each test case , there are 6 numbers Ai ( 1 <= Ai <= 100 ).

 
Output
If Dong-hao can achieve his goal , output "Grandpa Shawn is the Winner!"
If he can not , output "What a sad story!"
 
Sample Input
3
1 2 3 3 2 2
2 2 2 2 2 2
1 2 2 2 3 4
 
Sample Output
What a sad story!
What a sad story!
Grandpa Shawn is the Winner!
 
Hint

For the first test case , {3 , 1 , 2 , 2 , 2 , 3} Grandpa Shawn can take 6 at most . But Beautiful-leg Mzry can take 6 too. So there is a tie.
For the second test cases , Grandpa Shawn loses.
For the last one , Dong-hao can arrange the numbers as {3 , 2 , 2 , 2 , 1 , 4} , Grandpa Shawn can take 7 , but Beautiful-leg Mzry can take 6 at most. So Grandpa Shawn Wins!

 
解题:( ̄o ̄) . z Z   水
 
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <queue>
#include <cstdlib>
#include <string>
#include <set>
#include <stack>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
int d[],n;
int main() {
int t,i,j,grapa,mzry;
scanf("%d",&t);
while(t--){
for(i = ;i < ; i++)
scanf("%d",d+i);
sort(d,d+);
grapa = d[]+d[];
mzry = d[]+d[]+d[];
if(grapa > mzry){
puts("Grandpa Shawn is the Winner!");
}else puts("What a sad story!");
}
return ;
}

随机推荐

  1. Dock

    搭建本地 Registry - 每天5分钟玩转 Docker 容器技术(20) 小结: dock 版本号 分为 3位,比如1.1.2 就分为1, 1.1,1.1,2 这个几个版本 这种 tag 方案使 ...

  2. ORA-00445: Background Process "xxxx" Did Not Start After 120 Seconds

    Recent linux kernels have a feature called Address Space Layout Randomization (ASLR).ASLR  is a feat ...

  3. RFTWEB测试对象抓取的方法

    本文转自:http://feiyeguohai.iteye.com/blog/1468576 Rational Functional Tester (RFT) 作为 IBM 自己设计研发的自动化测试工 ...

  4. XamarinAndroid 自动绑定View变量

    Android 编程时我们少不了使用FindIdByView函数,在Xamarin Android开发时也需要如此.这个工作很无聊且烦人.在常规Android开发中,人们已经发明了一些方法免除这项工作 ...

  5. yii在Windows下安装(通过composer方式)

    Composer 安装: (Composer 不是一个包管理器,它仅仅是一个依赖管理工具.它涉及 "packages" 和 "libraries",但它在每个项 ...

  6. jq 中.html(),.text()和.val()的总结

    html与.text的方法操作是一样,只是在具体针对处理对象不同 html处理的是元素内容,.text处理的是文本内容 html只能使用在HTML文档中,.text 在XML 和 HTML 文档中都能 ...

  7. 番茄花园Ghost Win10系统X64位10041装机版2015年4月

    转载:系统妈,系统下载地址:http://www.xitongma.com/windows10/2015-04-01/6639.html 番茄花园Ghost Win10系统X64位10041装机版20 ...

  8. C/C++ 标准输入、输出

    一.分类 1.标准输入输出 键盘输入,显示器输出.2.文件输入输出 以外存为对象,即硬盘.光盘等.3.串输入输出 对内存中指定空间进行输入输出. 二.c语言中的输入输出 #include <st ...

  9. 理解 call, apply 的用法

    callcall() 方法使用一个指定的 this 值和单独给出的一个或多个参数来调用一个函数. function list() { return Array.prototype.slice.call ...

  10. HTTP的缺点与HTTPS

    a.通信使用明文不加密,内容可能被窃听 b.不验证通信方身份,可能遭到伪装 c.无法验证报文完整性,可能被篡改 HTTPS就是HTTP加上加密处理(一般是SSL安全通信线路)+认证+完整性保护