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 ...
随机推荐
- ios navigationController代码创建
1.新建类文件FirstViewController,subClass of:UIViewController 2.新建类文件MYNavigationController,subClass of:UI ...
- C - 小Y上学记——认识新同学
C - 小Y上学记——认识新同学 Time Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) ...
- js深入理解构造函数和原型对象
1.在典型的oop的语言中,如java,都存在类的概念,类就是对象的模板,对象就是类的实例.但在js中不存在类的概念,js不是基于类,而是通过构造函数(constructor)和原型链(propoty ...
- php 生成json格式的数据
放到引入的公共函数里边 if (!function_exists('format_json')) { /** * 格式化API输出的json * @param $return_code string ...
- 转:CSV Data Set Config 中文乱码问题
从csv读取中文一直乱码. CSV Data Set Config的File encoding为GB2312,对应参数化文件编码也为GB2312,但读取出变量值一直为乱码,后发现是Allow quot ...
- android常用工具类
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkIn ...
- Apriori算法-位运算-C语言
原文地址:http://blog.csdn.net/liema2000/article/details/6118423 //////////////////////////////////////// ...
- hdu_2089_不要62(数位DP)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2089 题意:中文,不解释 题解:dp[i][j]表示当前第i位的前一个数为j,然后记忆化dfs,注意的 ...
- why is agreement hard in a distributed system?
same question as: why is PAXOS necessary? 1, what if >1 nodes become leaders simultaneously? that ...
- Xcode6无法用xib得问题解决方法
1.创建一个新工程,选择singleView application 2.将storyboard和launchscreen删除,选择moveToTrash 3.删除info.plist文件中Main ...