B. Cover Points
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn).

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 nn (1≤n≤1051≤n≤105).

Each of the next nn lines contains two integers xixi and yiyi (1≤xi,yi≤1091≤xi,yi≤109).

Output

Print the minimum length of the shorter side of the triangle. It can be proved that it's always an integer.

Examples
input

Copy
3
1 1
1 2
2 1
output

Copy
3
input

Copy
4
1 1
1 2
2 1
2 2
output

Copy
4
Note

Illustration for the first example:

Illustration for the second example:

题意:唔就是,让你找到一个最小的等腰三角形,使得给出的所有点都包含在等腰三角形里或者等腰三角形边上

分析:  其实就是找给出的点在y轴上截距最大的时候,满足方程y=-x+b,移一下就是,x+y=b,只要找到x+y的最大值即可、

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
int n;
while(~scanf("%d",&n))
{
int a,b,ans=;
while(n--)
{
scanf("%d %d",&a,&b);
ans=max(a+b,ans);
}
printf("%d\n",ans);
}
return ;
}

1047B_Cover Points的更多相关文章

  1. 有理数的稠密性(The rational points are dense on the number axis.)

    每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.

  2. [LeetCode] Max Points on a Line 共线点个数

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  3. LeetCode:Max Points on a Line

    题目链接 Given n points on a 2D plane, find the maximum number of points that lie on the same straight l ...

  4. K closest points

    Find the K closest points to a target point in a 2D plane. class Point { public int x; public int y; ...

  5. 【leetcode】Max Points on a Line

    Max Points on a Line 题目描述: Given n points on a 2D plane, find the maximum number of points that lie ...

  6. Max Points on a Line

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  7. [LeetCode OJ] Max Points on a Line

    Max Points on a Line Submission Details 27 / 27 test cases passed. Status: Accepted Runtime: 472 ms ...

  8. [UCSD白板题] Points and Segments

    Problem Introduction The goal in this problem is given a set of segments on a line and a set of poin ...

  9. [UCSD白板题] Covering Segments by Points

    Problem Introduction You are given a set of segments on a line and your goal is to mark as few point ...

随机推荐

  1. folly无锁队列,尝试添加新的函数

    1. folly是facebook开源的关于无锁队列的库,实现过程很精妙.folly向队列中添加节点过程,符合标准库中的队列的设计,而取出节点的过程,则会造成多个线程的分配不均.我曾经试着提供一次 取 ...

  2. java多线程——监视锁(monitor)(转)

    https://blog.csdn.net/hqq2023623/article/details/51000153 java中每个对象都有唯一的一个monitor,想拥有一个对象的monitor的话有 ...

  3. openstack添加热添加硬盘并识别

    假定在虚拟机当中添加了磁盘,但是虚拟机没有识别出来:如何识别出来 可以使用命令 echo '- - -' >/sys/class/scsi_host/host0/scan 使用后就可以识别出来了 ...

  4. Zabbix 创建监控项目

    #1 #2 [root@nod01 zabbix_agentd.d]# pwd/etc/zabbix/zabbix_agentd.d 新建文件nod.conf [root@nod01 zabbix_a ...

  5. maven的包冲突

    maven的间接引用会引入其他未声明的包,maven自身的冲突解决方案,最终引用的包可能不是希望的版本. 直接声明期望的版本号,就没有间接引用的问题. 子模块很多时,可以使用dependencyMan ...

  6. windows下GitHub的安装、配置以及项目的上传过程详细介绍

    概要 本文主要介绍了在Win10系统中安装Github终端.如何配置安装好的Git终端以及如何利用Git终端将自己的项目上传到远程服务器中 操作必备 win10系统电脑一台.良好的互联网连接.GitH ...

  7. 谷歌获取chromium

    转自:http://blog.sina.com.cn/s/blog_496be0db0102voit.html 先参看 http://www.chromium.org/developers/how-t ...

  8. Sep 15th 2018

    人在最困难的最孤独的时候,是否都会有过怀疑和产生退缩的念头呢.开始怀疑为什么要坚持,坚持的意义何在.我现在的状态就是一个谋生赚钱的机器吗,远离妻子和孩子,一人孤独的在这座城市,得到的难道能够足以弥补所 ...

  9. python文件相关

    文件操作基本流程初探 f = open('chenli.txt') #打开文件 first_line = f.readline() print('first line:',first_line) #读 ...

  10. 最精简的自定义.net 开发框架

    一. 通过自定义的HttpModule和HttpHandler,重写url,自定义路由规则,实现 Web API功能. 简单说 就是  请求路径 例如 service/method, 那么就指向当前应 ...