HDU 3552 I can do it!
脑洞题。http://blog.csdn.net/dgq8211/article/details/7748078
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; struct abc
{
int A,B;
}x[];
int T,N;
int Max[]; bool cmp(const abc&a,const abc&b)
{
return a.A<b.A;
} int main()
{
scanf("%d",&T);
for(int t=;t<=T;t++)
{
scanf("%d",&N);
for(int i=;i<N;i++)
scanf("%d%d",&x[i].A,&x[i].B);
sort(x,x+N,cmp);
memset(Max,,sizeof Max);
int ans=0x7FFFFFFF;
Max[N-]=x[N-].B;
for(int i=N-;i>=;i--)
Max[i]=max(Max[i+],x[i].B);
for(int i=;i<N;i++)
ans=min(ans,x[i].A+Max[i+]);
printf("Case %d: %d\n",t,ans);
}
return ;
}
HDU 3552 I can do it!的更多相关文章
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
随机推荐
- UILabel设置富文本格式显示
实例化方法和使用方法 实例化方法: 使用字符串初始化 - (id)initWithString:(NSString *)str; 例: NSMutableAttributedString *Attri ...
- ural 1203. Scientific Conference(动态规划)
1203. Scientific Conference Time limit: 1.0 second Memory limit: 64 MB Functioning of a scientific c ...
- Ubuntu11.10 E: Unable to locate package ubuntu-restricted-extras
最近在ubuntu11.10下安装支持多媒体播放的插件时遇到一些问题,在此小记一下. 首先是ubuntu11.10的安装,基本上是一键安装,在此不细说. 1.此版本和以前使用的ubuntu版本风格不太 ...
- json 与entity/list/map的转换
一 json -> entity User.java package com.xxx.hotel.train.json.json2entity; import java.io.Serializ ...
- Spring的后置处理器BeanPostProcessor
一.BeanPostProcessor接口的作用 如果我们需要在Spring容器完成Bean的实例化.配置和其他的初始化前后添加一些自己的逻辑处理,我们就可以定义一个或者多个BeanPostProce ...
- python2.7学习记录之二
一.高级特性 1.切片取前3个元素用L[0:3]表示,从索引0开始取,直到索引3为止,但不包括索引3.如果第一个索引是0可省略.前10个数 每两个取一个L[:10:2],所有数 每5个取一个L[::5 ...
- c语言-error C2440: “static_cast”: 无法从“UINT (__thiscall CHyperLink::* )(CPoint)”转换为“LRESULT (__thiscall CWnd::* )(CPoint)”
出现这个错误的原因可是“人力不可抗拒”之原因造成的,因为旧版本的 ON_WM_NCHITTEST 宏使用了 UINT (__thiscall CWzButton::* )(CPoint); 类型的类成 ...
- 图片(img标签)大小自适应
$(function(){ var myimg,oldwidth,oldheight; var maxwidth=249; var maxheight=187; var imgs = document ...
- http?https?相对协议?
1 1 1 将CDN 上所有链接的协议默认设置为“相对协议”,也就是链接以 // 开头,前面去掉了 http: 或 https: 字样, 这样做的好处是浏览器能够根据你的网站所采用的协议来自动加载 C ...
- 在vim中使用perltidy美化perl代码
来源: http://www.cnblogs.com/itech/archive/2013/02/18/2915279.html 格式优美的perl代码不但让人赏心悦目,而且可以方便阅读. perlt ...