#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. ASP.NET页面生命周期描述

    下面是ASP.NET页面初始的过程:1. Page_Init();2. Load ViewState;3. Load Postback data;4. Page_Load();5. Handle co ...

  2. SQLServer在多个表中都增加一个字段的方法

    1.使用游标 declare @sql varchar(), @name varchar() declare my_cursor scroll cursor for select name from ...

  3. 不注册COM组件直接调用接口

    本文以COM组件AppTest.dll为例,AppTest.dll中提供了ITest接口,在不使用regsvr32命令向系统注册的情况下创建ITest接口并调用. 一.导入组件或类型库: 在C++中使 ...

  4. How to Iterate Over a Map in Java?(如何遍历Map)

    1.Iterate through the "entrySet" like so: public static void printMap(Map mp) { Iterator i ...

  5. boost库之graph入门

    #include <boost/graph/undirected_graph.hpp> #include <boost/graph/adjacency_list.hpp> us ...

  6. 常用的JS页面跳转代码调用大全

    一.常规的JS页面跳转代码 1.在原来的窗体中直接跳转用 <script type="text/javascript"> window.location.href=&q ...

  7. PAT (Advanced Level) 1102. Invert a Binary Tree (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  8. 고 해서: 表示在做B的各种理由中, A是代表性的理由

    1. 날씨도 좋고해서 산책이나 하려고 해요. 2. 할 일도 없고해서 일찍 돌어왔어요. 3. 기분도 우울하고 해서 친구란 술 마시기로 했어요. 可以加过去式和将来时使用 1. 수업도 끝 ...

  9. System.Text.RegularExpressions.Regex

    System.Text.RegularExpressions.Regex.IsMatch(string) 是否在指定字符串中找到制定项 System.Text.RegularExpressions.R ...

  10. 标准与扩展ACL实验

    一标准访问控制列表实验: 实验拓扑: 实验目的:掌握标准与扩展ACL的配置 实验要求:拒绝R1到R3的所有流量 实验步骤: 步骤1 按如上拓扑做好底层配置,并检测相邻设备之间的连通性 步骤2起静态路由 ...