Happy Three Friends
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
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.
For each test case , there are 6 numbers Ai ( 1 <= Ai <= 100 ).
If he can not , output "What a sad story!"
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!
#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 ;
}
随机推荐
- 51Nod 1315 合法整数集
1315 合法整数集 题目来源: TopCoder 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 一个整数集合S是合法的,指S的任意子集subS有Fu ...
- Glide清除缓存
Glide是谷歌推荐的一款加载图片的第三方框架,对内存优化更好,更省资源,他的众多好处,我就不一一描述了,有兴趣的朋友可以百度一下,介绍的还是挺详细的. 今天主要给大家介绍一下关于怎么获取Glide的 ...
- CCF|公共钥匙盒|Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = ...
- CCF|路径解析|Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=ne ...
- 锐动SDK针对游戏直播提出的解决方案
方案架构 PC端视频直播与录播功能为游戏厂商宣传,玩家个人秀,大型电竞赛事提供完美的技术解决方案. 直播形式灵活多变不,同音源的选择,画面切换,游戏中嵌入摄像头丰,富解说画面.突出主播个人魅力与粉丝形 ...
- SQL Server调试存储过程
一. 调试SQL Server 2000 1. 设置帐户. <1> 在windows服务中找到MSSQLSERVER,双击弹出对话框. <2> 选择 ...
- JSP标签 <meta.....>作用总结
<metahttp-equiv="pragma" content="no-cache"> <metahttp-equiv="cach ...
- 重装macOS环境配置笔记
由于早些年买mac的时候写代码的经验还不够,导致多年使用后mac上装满了乱七八糟的软件,比如python就有系统自带的,xcode里的,pyenv的,以及brew安装的各种版本,nginx,Apach ...
- DEALLOCATE - 删除一个准备好的查询
SYNOPSIS DEALLOCATE [ PREPARE ] plan_name DESCRIPTION 描述 DEALLOCATE 用于删除前面准备好的查询. 如果你没有明确 DEALLOCATE ...
- new Buffer 生成二进制数据
node编辑环境下: > new Buffer("admin")<Buffer 61 64 6d 69 6e> 通过post请求,服务端接收到是流数据,必须把流数 ...