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 ...
随机推荐
- javascript 值传递
在js中 简单类型是值传递 复杂类型是引用传递 简单类型:String Number Boolean undefined Null 复杂类型:Object 下面的代码演示这个 var simpleNa ...
- Confluence搭建
参见 https://confluence.atlassian.com/display/CONF54/Installing+the+Confluence+EAR-WAR+Edition 下载5.4.4 ...
- docker私服
1.下载私服镜像docker pull registry 2.启动容器docker run -d -p 5000:5000 -v /opt/data/registry:/var/lib/registr ...
- __doPostBack初识
周五在公司看到有看到Request.Params["__EVENTARGUMENT"]的代码不解,不解遂上网查找,发现一篇文章<Understanding the JavaS ...
- YaHoo Web优化的14条法则
Web应用性能优化黄金法则:先优化前端程序(front-end)的性能,因为这是80%或以上的最终用户响应时间的花费所在. 法则1. 减少HTTP请求次数 80%的最终用户响应时间花在前端程序上,而其 ...
- 转:应用JMeter测试solr请求
使用JMeter测试solr请求 一.安装JMeter 在官网http://jmeter.apache.org/download_jmeter.cgi下载JMeter 直接解压JMeter安装包 Li ...
- Internet History, Technology and Security (Get Started)
Abstract 课程名称:互联网的历史.技术和安全 coursera地址 制作方:密歇根大学(University of Michigan) 教师:Charles Severance, Associ ...
- LeetCode OJ 337. House Robber III
The thief has found himself a new place for his thievery again. There is only one entrance to this a ...
- linux 架设 postfix 邮件服务器
http://www.cnblogs.com/dudu/archive/2012/12/12/linux-postfix-mailserver.html
- ActionBar更改背景颜色(主题)
1.默认是黑色的背景, 2.更改主题theme为Theme.AppCompat.Light即可,清单文件主题如下: <application android:name="com.ith ...