A Famous ICPC Team

时间限制:1000 ms  |  内存限制:65535 KB
难度:2
描述

Mr. B, Mr. G, Mr. M and their coach Professor S are planning their way to Warsaw for the ACM-ICPC World Finals. Each of the four has a square-shaped suitcase with side length Ai (1<=i<=4) respectively. They want to pack their suitcases into a large square box. The heights of the large box as well as the four suitcases are exactly the same. So they only need to consider the large box’s side length. Of course, you should write a program to output the minimum side length of the large box, so that the four suitcases can be put into the box without overlapping.

输入
Each test case contains only one line containing 4 integers Ai (1<=i<=4, 1<=Ai<=1,000,000,000) indicating the side length of each suitcase.
输出
For each test case, display a single line containing the case number and the minimum side length of the large box required.
样例输入
2 2 2 22 2 2 1
样例输出
Case 1: 4Case 2: 4
提示
For the first case, all suitcases have size 2x2. So they can perfectly be packed in 
a 4x4 large box without wasting any space.
For the second case, three suitcases have size 2x2 and the last one is 1x1. No
matter how you rotate or move the suitcases, the side length of the large box must
be at least 4.
来源
hdu
上传者
李如兵

题意:

先生,先生,M先生和他们的教练教授的计划去华沙为承办世界杯决赛。每四个有一个方形的手提箱边长AI(1≤i<=4)分别。他们想收拾自己的行李放到一个大的方形盒。的大盒子的高度以及四个手提箱是完全相同的。所以他们只需要考虑的大盒子的边的长度。当然,你应该写一个程序来输出最小边长的大盒子,使四个箱子可以放进盒不重叠。

每个测试用例包含只有一行有4个整数AI(1 < =我≤4,1≤ai≤1000000000)指示每个箱子边长度。

思路 :求出最大两个箱子长度之和 不就可以全部装下了吗

#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;int main()
{int len[4];int d=1;while(cin>>len[0]>>len[1]>>len[2]>>len[3]){sort(len,len+4);printf("Case %d: %d\n",d++,len[2]+len[3]);}
}

nyoj107hdu A Famous ICPC Team相关推荐

  1. 【Codeforces gym 102388】SUFE ICPC Team Formation Test,签到题BDG

    B Stars /* 题意:求二维平面上(x1,y1),(x2,y2)连成的直线上有多少个整数点 思路:以(x1,y1)为原点建立新的坐标系,答案为gcd(|x2-x1|,|y2-y1|)+1 */ ...

  2. 【机试】2011-2020年复旦大学考研复试机试真题

    题型分布目录 一.DP问题 [2011-1]DP-最长公共子序列LCS [2014-2]DP-字符串的编辑距离 [2014-4]DP-Hanoi 塔 [2016-1]DP-求最大连续公共字串长度 [2 ...

  3. 13-19年复旦大学计算机学院研究生复试机试题

    (不保证代码完全正确,自己敲的可能存在不完善的地方,请各位大佬发现后指出,谢谢!) 暂时结束. 试题列表 2019上机题 2018上机题 2017上机题 2016上机题 2015上机题 2014上机题 ...

  4. 第18届浙江大学校赛 Mergeable Stack

    The 18th Zhejiang University Programming Contest Sponsored by TuSimple 第18届浙江大学校赛的c题 解析:起先是用stack写的模 ...

  5. 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - F - A Mame】

    Home Problems Status Contest Register Login B题要套一个数论的模版,注意m=1!! C题可以二分匹配,把行列看作点; 不能开百度,开谷歌搜题解,再次强调!一 ...

  6. P,MTHBGWB 水题

    今天遇到一道特别恶心的水题,可能是我水平太low,居然用了好久的时间!不过主要是用在看懂题意上了,英文题目好长,好恶心啊!!题目如下: Description Morse code represent ...

  7. The 19th Zhejiang Provincial Collegiate Programming Contest

    文章目录 [A.JB Loves Math](https://codeforces.com/gym/103687/problem/A) [B.JB Loves Comma](https://codef ...

  8. 十九届 浙大 校赛 A题 Thanks, TuSimple!

    题目链接: http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5969 Thanks, TuSimple! Time ...

  9. ZOJ 3228 Searching the String (AC自动机)

    题意: 给你一个模板串, 和n 个要匹配的串, 匹配串有两种类型, 第一种 可以在模板串中 重叠 出现, 另一种不可以重叠, 问每个串的两种形式 所出现的数量. 思路: 很明显ac自动机. 我们先把所 ...

  10. The Preliminary Contest for ICPC Asia Xuzhou 2019 徐州网络赛 XKC's basketball team

    XKC , the captain of the basketball team , is directing a train of nn team members. He makes all mem ...

最新文章

  1. hdu Remainder
  2. 使用SpringBoot配置了 server.servlet.path后无效的解决方案
  3. aide怎么打开html文件,求助!aide获取网页html源码
  4. java中获取文件总行数_关于java:如何以有效的方式获取文件中的行数?
  5. centos php日志分析,记录一下CentOS7安装GoAccess日志分析工具
  6. vsftpd 源码安装 linux/redhat
  7. Github git clone国内mirror加速
  8. XNA开发思考之3D开发中的小常识
  9. 《树莓派Python编程入门与实战》——2.1 了解Linux
  10. 基础原理系列:服务端 TCP 连接的 TIME_WAIT 问题
  11. 112654 个招聘数据告诉你,程序员 2019 年该去哪!
  12. es 使用ik停词_ES使用IK分词器
  13. 基于RV1126平台imx291分析 --- 统计已注册的设备信息
  14. Matlab代码:综合能源系统(IES)的优化调度
  15. 全链路压测应该怎么做?答案都在这里了!
  16. 楚留香服务器维护时间,《一梦江湖》手游官方网站_《楚留香》现已全面升级重制-3月9日维护更新公告...
  17. 【网页设计】基于HTML+CSS+JavaScript制作美食网站舌尖上的美食
  18. 每周论文精读04——A Survey on 3D Hand Pose Estimation: Cameras, Methods, and Datasets
  19. python目标函数最大_python运筹优化(三):遗传算法和Geatpy使用实践
  20. 属性与意图识别_一种基于多任务学习的意图与槽位联合识别方法与流程

热门文章

  1. SpringMVC简单映射请求参数介绍
  2. 四则运算界面版 结对子
  3. An ac a day,keep wa away
  4. android中常用的开源项目
  5. ESX中的虚拟机中安装虚拟机的实现
  6. Android流媒体
  7. 如何删减QQ无用功能 为系统彻底减负
  8. logback 打印日志参考,包含异步打印日志及历史日志压缩
  9. 矩阵连乘备忘录算法java_矩阵连乘(备忘录方法:自顶向下递归)
  10. c语言 滑窗法_滑窗算法