原题链接
http://codeforces.com/contest/813/problem/A
解题思想
略
代码
#include<iostream>
using namespace std;
int main()
{
    int m,n,i,x,t=0,l,r=0;
    cin>>n;
    while(n--)
    {
        cin>>x;
        t+=x;
    }
    cin>>m;
    while(m--&&t>r)cin>>l>>r;
    if(t>r) cout<<-1;
    else cout<<max(t,l);
    return 0;
}
 京公网安备 11010502036488号
京公网安备 11010502036488号