首页 > 移动平台 > 详细

BNU OJ 50999 BQG's Approaching Deadline

时间:2015-12-26 13:22:21      阅读:279      评论:0      收藏:0      [点我收藏+]

#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1000+10;
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=1;i<=n;i++)
            scanf("%lld%lld",&h[i].st,&h[i].len);
        long long ans=0;
        sort(h+1,h+1+n,cmp);
        for(int i=1;i<=n;i++)
        {
            ans=max(ans,h[i].st);
            ans=ans+h[i].len;
        }
        printf("%lld\n",ans);

    }
    return 0;
}

 

BNU OJ 50999 BQG's Approaching Deadline

原文:http://www.cnblogs.com/zufezzt/p/5077773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!