#include<cstdio>
#include<algorithm>
using namespace std; const int maxn=+;
struct Homework
{
long long st;
long long len;
}h[maxn];
int n; bool cmp(const Homework&a,const Homework&b)
{
return a.st<b.st;
} int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%lld%lld",&h[i].st,&h[i].len);
long long ans=;
sort(h+,h++n,cmp);
for(int i=;i<=n;i++)
{
ans=max(ans,h[i].st);
ans=ans+h[i].len;
}
printf("%lld\n",ans); }
return ;
}

BNU OJ 50999 BQG's Approaching Deadline的更多相关文章

  1. BNU OJ 51005 BQG's Quadrilateral Bricks

    #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include ...

  2. BNU OJ 51000 BQG's Random String

    #include<cstdio> #include<cstring> #include<algorithm> using namespace std; +; cha ...

  3. BNU OJ 51003 BQG's Confusing Sequence

    二进制++高精度取模 #include<cstdio> #include<cstring> #include<algorithm> using namespace ...

  4. BNU OJ 50998 BQG's Messy Code

    #include <cstdio> #define _(l) int l #define ___(l,L) for (_(o)=0,x=l o*2;o<x;o++)O= L o; # ...

  5. BNU OJ 50997 BQG's Programming Contest

    #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using ...

  6. BNU OJ 33691 / LA 4817 Calculator JAVA大数

    留着当个模板用,在BNU上AC,在LA上RE……可能是java的提交方式不同??? 数和运算符各开一个栈. 表达式从左到右扫一遍,将数存成大数,遇到数压在 数的栈,运算符压在 运算符的栈,每当遇到右括 ...

  7. BNU OJ 1027 金币系统

    金币系统 Time Limit: 1000ms Memory Limit: 65535KB   64-bit integer IO format: %lld      Java class name: ...

  8. bnu oj 13288 Bi-shoe and Phi-shoe

    题目链接: http://www.bnuoj.com/contest/problem_show.php?pid=13288 题目大意: 给出一个n,然后给出n个幸运数([1,m]中不能被m整除的数的数 ...

  9. ACM数据结构相关资料整理【未完成,待补充】

    在网上总是查不到很系统的练ACM需要学习的数据结构资料,于是参考看过的东西,自己整理了一份. 能力有限,欢迎大家指正补充. 分类主要参考<算法竞赛入门经典训练指南>(刘汝佳),山东大学数据 ...

随机推荐

  1. jquery完美实现textarea输入框限制字数

    <html> <head> <title> jquery完美实现textarea输入框限制字数</title> <meta http-equiv= ...

  2. php根据时间显示刚刚,几分钟前,今天,昨天的实现代码

    如果大家有更好的方案欢迎交流 function diffBetweenTwoDay($pastDay){ $timeC = time() - strtotime($pastDay); $dateC = ...

  3. 关于JAVA插入Mysql数据库中文乱码问题解决方案

    方案一:在创建client的时候,指定使用的编码方式  具体如下: conn = DriverManager.getConnection("jdbc:mysql://localhost:33 ...

  4. java模式:模板模式的简单理解

    1.模板模式就是用虚类作为基类将几个要执行差不多操作中相同的部分提取出来,不同的部分各自实现! 2.下面给出简单栗子: 我要进行的操作是将大象和狐狸放入冰箱,放入大象和狐狸有相同的步骤:开冰箱和关冰箱 ...

  5. oracle多种导入导出数据方法

    dmp格式: 1.dmp格式的导出可以通过客户端工具(PL/SQL)操作来完成,通过菜单栏---->Tools---->Export Tables,然后设置勾选相应参数即可,rows代表是 ...

  6. 格式化格林威治时间(Wed Aug 01 00:00:00 CST 2012)

    1.如果格林威治时间时间是date类型.(这种格式最简单)       SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd") ...

  7. kinect for windows - DepthBasics-D2D详解

    引自:http://blog.csdn.net/itcastcpp/article/details/20282667 Depth在kinect中经常被翻译为深度图,指的是图像到摄像头的距离,这些距离数 ...

  8. HDU2050 由直线分割平面推广到折线分割平面

    直线分割平面问题: 加入已有n-1条直线,那么再增加一条直线,最多增加多少个平面? 为了使增加的平面尽可能的多,我们应该使新增加的直线与前n条直线相交,且不存在公共交点.那么我们可以将新增加的这条直线 ...

  9. linux的学习系列 2--文件系统

    Linux中的所有数据都被保存在文件中,所有的文件被分配到不同的目录.目录是一种类似于树的结构,称为文件系统. 当你使用Linux时,大部分时间都会和文件打交道,通过本节可以了解基本的文件操作,如创建 ...

  10. cfedu/A/求和

    题目连接 思路: 用数组直接标记2^n,n属于(0~~31);用LL或者INT都可以,不会爆.但是ans要用LL. #include <set> #include <map> ...