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. [UE4]控件模板

    控件模板:一个UI可以作为另外一个UI的子控件,这个子控件就是控件模板. 控件模板一般使用“Size Box”组件作为根节点,给“Size Box”组件设置合适的尺寸,显示模式选择“Desired”, ...

  2. mysql为什么要分库分表?

    1 基本思想之什么是分库分表?从字面上简单理解,就是把原本存储于一个库的数据分块存储到多个库上,把原本存储于一个表的数据分块存储到多个表上. 2 基本思想之为什么要分库分表? 单表操作数据量有最优值, ...

  3. Mybatis 系列3-结合源码解析properties节点和environments节点

    [Mybatis 系列10-结合源码解析mybatis 执行流程] [Mybatis 系列9-强大的动态sql 语句] [Mybatis 系列8-结合源码解析select.resultMap的用法] ...

  4. docker设置容器固定ip

    docker安装后,默认会创建三种网络类型,bridge.host和none,可通过如下命令查看 sudo docker network ls 1 bridge:网络桥接 默认情况下启动.创建容器都是 ...

  5. boost 学习笔记 1: lexical_cast

    参考原著地址:http://einverne.github.io/post/2015/12/boost-learning-note-1.html 转换对象要求 lexical_cast 对转换对象有如 ...

  6. CPU Rings, Privilege, and Protection.CPU的运行环, 特权级与保护

    原文标题:CPU Rings, Privilege, and Protection 原文地址:http://duartes.org/gustavo/blog/ [注:本人水平有限,只好挑一些国外高手的 ...

  7. Android WebView无法播放视频或直播,关闭界面后任在播放的问题;

    1.设置webview属性: webView.setWebChromeClient(new MyWebChromeClient());         webSettings = webView.ge ...

  8. 在Raid模式下装Win10找不到固态硬盘怎么办

    现在新出厂的笔记本电脑中,系统的BIOS内,SATA Controller Mode默认设置的是为Intel RST Premium模式,该模式会将硬盘组成磁盘阵列的模式(Raid模式),而原版的Wi ...

  9. django之模板系统 --》内容(filter过滤器、tags标签【for、if、with】、母板以及继承、crf_token、注释、组件、静态文件【load static】、get_static_prefix、自定义标签和tag)

    常用: Django模板中只需要记两种特殊符号: {{ }}和 {% %} {{ }}表示变量,在模板渲染的时候替换成值,{% %}表示逻辑相关的操作. 变量 {{ 变量名 }} 变量名由字母数字和下 ...

  10. thinkphp 验证的使用

    TP5验证可分为独立验证和验证器: 独立验证是可直接写在控制器里直接验证如下: //独立验证 $data = [ 'name'=>'vendor33333', 'email'=>'vaen ...