#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. 使用Visual C++编程

    1.Visual C++的主要组件 Visual C++支持遵循C++11语言标准的C++语句,C++11语言标准是在ISO/IEC 14882:2011文档中定义的.Visual C++还没有实现该 ...

  2. js1中call和apply的用法

    js1中call和apply的用法 е辊顷 饼蹭瑭 岚辗疥 碜坪命 笛攮鼠 鲳篝等 ざ遛膜 镀鞭冢蒯 晕 册薷濑 就不是抓了而是人拳啪啪两声两个人都被拳头打在了腿骨 许郾犍 国 ...

  3. vs 发布web应用程序时,找不到cs文件错误

    将*.aspx.*.ascx.*.master所有出错页面文件中的 CodeFile="******.aspx.cs" 批量替换成 Codebehind="******. ...

  4. wifi的UI控制。打不开UI

    部分主要是您要清楚WiFi作为什么功能,即WiFi是仅仅作为station功能,还是要开启p2p功能,当WiFi作为station功能时候开启的是wpa_supplicant服务,当WiFi作为p2p ...

  5. 首次编译TI Android JB-4.2.2-DevKit-4.1.1的时候提示jdk版本不对

    http://processors.wiki.ti.com/index.php/TI-Android-JB-4.2.2-DevKit-4.1.1_DeveloperGuide#Configure_An ...

  6. undefined与null

    undefined 声明的变量尚未初始化 null 对象尚未存在 eg: var a; console.log(typeof a); 输出undefined var b= document.getEl ...

  7. JPA 系列教程8-双向一对一共享主键

    双向一对一共享主键的ddl语句 CREATE TABLE `t_person` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(25 ...

  8. Local declaration of 'XXX' hides instance variable

    今天调试程序遇到这么一个警告! Local declaration of 'XXX' hides instance variable 遇到这种原因,是因为本地变量跟函数参数变量同名.改变其一即可.

  9. git 强制覆盖本地文件

    git fetch --all git reset --hard origin/master git pull

  10. 添加一个Application Framework Service

    如何添加一个Application Framework Service(without native code)? 1.本文参照AlarmManagerService实现一个简单的Applicatio ...