版权声明:大佬您能赏脸,蒟蒻倍感荣幸,还请联系我让我好好膜拜。 https://blog.csdn.net/ShadyPi/article/details/82917149
原题链接:http://codeforces.com/contest/1047/problem/B
Cover Points
There are points on the plane, .
You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle or on the side of the triangle). Calculate the minimum length of the shorter side of the triangle.
Input
First line contains one integer .
Each of the next lines contains two integers and .
Output
Print the minimum length of the shorter side of the triangle. It can be proved that it’s always an integer.
Examples
input
3
1 1
1 2
2 1
output
3
input
4
1 1
1 2
2 1
2 2
output
4
Note
Illustration for the first example:
Illustration for the second example:
题解
算算每个点对应的等腰直角三角形的大小,取个 即可。
代码
#include<bits/stdc++.h>
using namespace std;
int n,ans;
void in(){scanf("%d",&n);}
void ac()
{
for(int i=1,a,b;i<=n;++i)
scanf("%d%d",&a,&b),ans=max(ans,a+b);
printf("%d",ans);
}
int main(){in();ac();}