Problem Description
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.

Input
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.

Output
For each test case, display a single line containing
the case number and the minimum side length of the large box required.

Sample Input
2 2 2 2
2 2 2 1

Sample Output
Case 1: 4
Case 2: 4

Hint

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.

``` #include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
];
bool check(long long b)
{
]>=a[])
return true;
return false;
}
int main()
{
double maxn,minn,mid;
;
]>>a[]>>a[]>>a[])
{
t++;
sort(a,a+);
minn=sqrt(a[]*a[]+a[]*a[]+a[]*a[]+a[]*a[]);
maxn=a[]*;
while(minn+0.1<maxn)
{
mid=(minn+maxn)/;
if(check(mid))maxn=mid;
else minn=mid;
}
printf("Case %d: %.0lf\n",t,minn);
}
;
}```

## HDU 4247 A Famous ICPC Team的更多相关文章

1. HDU 4251 The Famous ICPC Team Again 主席树

The Famous ICPC Team Again Problem Description   When Mr. B, Mr. G and Mr. M were preparing for the ...

2. HDU 4251 The Famous ICPC Team Again(划分树)

The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

3. hdu 4251 The Famous ICPC Team Again划分树入门题

The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

4. HDOJ 4251 The Famous ICPC Team Again

划分树水题..... The Famous ICPC Team Again Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 3276 ...

5. 【HDOJ】4251 The Famous ICPC Team Again

划分树模板题目,主席树也可解.划分树. /* 4251 */ #include <iostream> #include <sstream> #include <strin ...

6. HDU4251-The Famous ICPC Team Again（划分树）

Problem Description When Mr. B, Mr. G and Mr. M were preparing for the 2012 ACM-ICPC World Final Con ...

7. HDU 2017 Multi-University Training Contest - Team 4 1009 1011

Questionnaire Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)T ...

8. HDU 5475（2015 ICPC上海站网络赛）--- An easy problem（线段树点修改）

题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5475 Problem Description One day, a useless calculato ...

9. hdu 4255 A Famous Grid

题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4255 A Famous Grid Description Mr. B has recently dis ...

## 随机推荐

1. poj2503

有关字符串的hash,用黑书上推荐的传说中的ELFhash函数 输入的话,用sscanf处理比較简洁 #include<iostream> #include<cstring> ...

2. 织梦DEDE文章列表前面自动加递增数字标签

实现的办法很简单,只须要在序号递增的处所加上这段代码就行 [field:global runphp=""yes"" name=autoindex][/field ...

3. Java与算法之(3) - 斐波那契数列

斐波那契数列问题:如果一对兔子每月能生1对小兔子,而每对小兔在它出生后的第三个月里,又能开始生1对小兔子,假定在不发生死亡的情况下,由一对初生的兔子开始,1年后能繁殖出多少对兔子? 首先手工计算来总结 ...

4. Vue 非父子组件通信方案

Vue 非父子组件通信方案 概述 在 Vue 中模块间的通信很普遍 如果是单纯的父子组件间传递信息,父组件可以使用 props 将数据向下传递到子组件,而在子组件中可以使用 events (父组件需要 ...

5. Node.js_简介及其 npm 包管理器基本使用_npm_cnpm_yarn_cyarn

Node.js 既是语言也是平台,跳过了 Apache.Nginx 等 HTTP 服务器,直接面向前端开发 JavaScript 是由 ECMAScript.文档对象模型(DOM)和浏览器对象模型(B ...

6. vue前端框架面试问题汇总

7. pycharm的中文汉化

下载pycharm软件 然后通过下面的网站进行激活: http://idea.lanyus.com/ 激活好后下载汉化包:链接:http://pan.baidu.com/s/1i5zaGgX 密码:g ...

8. [JS] ECMAScript 6 - Variable : compare with c#

前言 范围包括:ECMAScript 新功能以及对象. 当前的主要目的就是,JS的学习 --> ECMAScript 6 入门 let 命令 js 因为let, i的范围限制在了循环中. var ...

9. Spring Boot启动流程

基础准备 1,BeanPostProcessor:这个接口的作用在于对于新构造的实例可以做一些自定义的修改.比如如何构造.属性值的修改.构造器的选择等等 2,BeanFactoryPostProces ...

10. 使用路径arc-奥运五环