【CUGBACM15级BC第四场 A】hdu 4931 Happy Three Friends

Fullstack Vue - The Complete Guide to Vue.js and Friends pdf Fullstack Vue - The Complete Guide to Vue.js and Friends pdf 高清英文原版 立即下载

Happy Three Friends

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


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!
 

解题思路:

六个数排序,比较最大的两个数的和  与 第二三四三个数的和  比较

#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <bitset>
#include <string>
#include <vector>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <functional>
#define PI acos(-1)
#define eps 1e-8
#define inf 0x3f3f3f3f
#define debug(x) cout<<"---"<<x<<"---"<<endl
typedef long long ll;
using namespace std;

int a[105];
int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
    {
        memset(a, 0, sizeof(a));

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



 
[特殊字符]交通标志检测与分类数据集-智能驾驶系统 地图数据更新 1,886张图片 🚦交通标志检测与分类数据集-智能驾驶系统 地图数据更新 1,886张图片 阅读详情

相关推荐

Keil5安装教程(保姆级)Keil5mdk安装步骤

6、复制生成的激活码,粘贴在New License ID Code处,点击Add LIC,即可成功激活mdk,显示mdk的使用期限。6、复制生成的激活码,粘贴在New License ID Code处,点击Add LIC,即可成功激活C51,显示mdk的使用期限;3、在安装文件中点击keygen.exe文件,粘贴复制过的CID,选择Target为C51,点击Generate,生成激活码;4、在弹出的界面中会自动安装在安装keil的路径,点击“Next”进行后续安装,安装完成后,点击“Finish”。

m6886258的博客 9万+

Bestcoder4——Happy Three Friends(二叉堆)

本文出自:http://blog.csdn.net/svitter 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

svitter的专栏 2243

通过声音识别鸟类

根据野生鸟类的外表来识别它是一回事。仅仅根据声音来识别同一只鸟是另一回事。除非你是一个熟练的观鸟者,通过声音识别鸟类可能相当具有挑战性德国马尔堡大学的一组数学、计算机科学和生物学研究人员设计了一种快速识别鸟类和监测当地生物多样性的方法。他们使用连接到 NVIDIA 的便携式设备拍摄的录音根据研究人员的说法是一个边缘人工智能系统,“基于分布式系统中运行的嵌入式边缘设备,能够对森林中记录的声景进行高效、连续的评估。”要了解更多信息,请参阅。

分享AI前沿科技 1682

[4931]:Happy Three Friends

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 num

Μῆτις -- chengfengYang_LMN 1993

OpenCV 常用的API总结(迅速查询)

OpenCV基本操作 openCV安装 读取图片(IO操作) 绘制集合图形 图像加法以及混合操作 OpenCV图像处理 图像几何变换 形态学操作 图像平滑 直方图 边缘检测 模板匹配 傅里叶变换 轮廓检测 图像分割 图像特征提取 SIFT检测关键点 视频读写............

Peyzhang的博客 3938

MQTT与物联网平台(一):基础知识和设备接入物联网平台的实现(以华为云为例)

本文简单介绍了MQTT的基础知识和使用方法,以蓝牙WIFI双模芯片W801作为硬件设备,接入到华为云。

weixin_50622833的博客 1万+

SSL证书评估全攻略:五大维度避开选型与部署的坑

数字证书与SSL/TLS协议是保障HTTPS通信安全的基石,服务器证书通过验证身份和建立加密通道,让用户与网站之间的数据传输免遭窃听与篡改。但证书选型绝非“买个文件挂上”那么简单——证书链是否完整、加密强度是否达标、DV/OV/EV验证级别如何匹配业务风险、通配符证书有哪些隐含限制、ACME自动化续期能否落地,这些都会直接影响浏览器兼容性、运维效率甚至合规审计结果。本文从实际工程视角出发,先厘清不同业务场景下的证书需求,再围绕信任度、加密参数、证书类型、运维体验、长期成本五个维度展开评估框架,最后附上常见报

aofan9566的博客 342

WIFI基础入门--802.11g--增强速率物理层ERP--15

WIFI基础入门--802.11--增强速率物理层--191.802.11g的组件保护机制 1.802.11g的组件 802.11g其实是将好几种物理层规范合而为一。虽然统称为增强速率物理层(Extended Rate PHY简称ERP),但是实际上ERP有好几种不同的方式: ERP-DSSS与ERP-CCK 这两种模式向下兼容于原始直接序列规范(1Mbps与2Mbps),以及所提到的802.11...

香蕉一号 4628

HDU 4931 Happy Three Friends(水)

HDU 4931 Happy Three Friends 题目链接 题意:6个数字,一个取两个,妹子取三个,问最后谁会赢 思路:排个序,判断前两个和3 - 5个的和谁更大即可 代码: #include #include #include #include using namespace std; int t, a[6]; int main() {

Remilia's 1143

车载通信技术原理-CAN通讯和代码配置:奥迪A6轿车总线拓扑图

CAN总线是一种用于汽车监测与控制系统的串行通信协议,由德国Bosch公司开发。它具有多主工作方式、优先级仲裁、高抗干扰等特点,支持点对点、广播等多种通信方式,传输距离可达10公里。CAN协议采用差分信号传输,物理层使用双绞线,数据链路层实现错误检测、位填充等功能。协议帧类型包括数据帧、遥控帧、错误帧等。CAN总线自1986年发布以来,已成为汽车电子系统的标准配置,广泛应用于车载网络。文章还提供了S32K144芯片的CAN驱动代码示例。

擎天柱工坊 1075

电机传动机构的转矩与惯量折算

参考《工业运动控制》

庐州牧 1万+

【水题】HDU4931Happy Three Friends【BestCoder Round #4】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4931 #include #include using namespace std; int a[10]; int main() { int t; cin>>t; while(t--){ for(int i=0;i<6;i++){ cin

wlxsq的专栏 833

双向晶闸管交流调压基础知识及Multisim电路仿真

本文介绍了双向晶闸管交流调压电路的工作原理及应用。该电路由双向晶闸管、RC移相电路和双向触发二极管组成,通过调节电位器改变触发角实现电压调节。当电位器阻值减小时,触发角减小,输出电压升高;阻值增大时,触发角增大,输出电压降低。Multisim仿真展示了不同电位器档位下的波形特征:0%档位时全导通,50%档位时半导通,100%档位时基本关断。该电路结构简单、调节平滑,广泛应用于调光、调速等场合,但会产生谐波干扰。

XU157303764的博客 853

hdu 4931 Happy Three Friends

排序  最大俩个数 相加。。

z8853797的专栏 907

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

BestCoder Round #4(Happy Three Friends-贪心)

Happy Three Friends Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 934 Accepted Submission(s): 738 Problem Description Dong-hao , Gra

nike0good |Oier&ACMer | 熟能生巧 1375

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Happytreefriends

http://happytreefriends.atomfilms.com/index.html 心理素质不好勿进 转载于:https://www.cnblogs.com/hyouhaku/archive/2005/02/08/103342.html

weixin_30478923的博客 547

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

【CUGBACM15级BC第32场 A】hdu 5182 PM2.5

结构体排序

Gzbgreat的博客 513

【CUGBACM15级BC第22场 C】hdu 5144 NPY and shot

三分+物理

Gzbgreat的博客 513

【CUGBACM15级BC第18场 B】hdu 5105 Math Problem

蛋疼

Gzbgreat的博客 509

【CUGBACM15级BC第二场 B】hdu 4884 TIANKENG’s rice shop

模拟QAQ

Gzbgreat的博客 508

【CUGBACM15级BC第19场 A】hdu 5108 Alexandra and Prime Numbers

一个数的因数分解

Gzbgreat的博客 491

【CUGBACM15级BC第33场 A】hdu 5186 zhx's submissions

模拟+高精度

Gzbgreat的博客 468

【CUGBACM15级BC第18场 A】hdu 5104 Primes Problem

筛素数

Gzbgreat的博客 457

【CUGBACM15级BC第35场 A】hdu 5194 DZY Loves Balls

思维+乱搞

Gzbgreat的博客 453

【CUGBACM15级BC第17场 A】hdu 5100 Chessboard

,,,

Gzbgreat的博客 452
上一篇: 【CUGBACM15级BC第37场 A】hdu 5202 Rikka with string
下一篇: 【CUGBACM15级BC第四场 B】hdu 4932 Miaomiao's Geometry
斌同学斌同學
博客等级 码龄10年 4粉丝 257原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值