1047B_Cover Points
1 second
256 megabytes
standard input
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.
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).
Print the minimum length of the shorter side of the triangle. It can be proved that it's always an integer.
3
1 1
1 2
2 1
3
4
1 1
1 2
2 1
2 2
4
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的更多相关文章
- 有理数的稠密性(The rational points are dense on the number axis.)
每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.
- [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. ...
- 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 ...
- K closest points
Find the K closest points to a target point in a 2D plane. class Point { public int x; public int y; ...
- 【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 ...
- 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. ...
- [LeetCode OJ] Max Points on a Line
Max Points on a Line Submission Details 27 / 27 test cases passed. Status: Accepted Runtime: 472 ms ...
- [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 ...
- [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 ...
随机推荐
- 远程服务器安装mysql数据库
https://www.cnblogs.com/renjidong/p/7047396.html 1.新开的云服务器,需要检测系统是否自带安装mysql # yum list installed | ...
- go语言学习--指针的理解
Go 的原生数据类型可以分为基本类型和高级类型,基本类型主要包含 string, bool, int 及 float 系列,高级类型包含 struct,array/slice,map,chan, fu ...
- Android 使用自定义字体
整个项目要使用第三方字体首先将字体文件放到assets文件夹下 因为整个项目要用第三方字体这里我重写了 TextView Button EditText 三个控件 以TextView 为例代码如下 ...
- 从MediaStorehe和sd中删除媒体文件
参考资料:http://www.sandersdenardi.com/querying-and-removing-media-from-android-mediastore/ 从媒体表中删除: pri ...
- C#深入解析委托——C#中为什么要引入委托
引言: 对于一些刚接触C# 不久的朋友可能会对C#中一些基本特性理解的不是很深,然而这些知识也是面试时面试官经常会问到的问题,所以我觉得有必要和一些接触C#不久的朋友分享下关于C#基础知识的文章,所以 ...
- c#数组用法
随机数: string[] str = new string[4]{"a","b","c","d"} Readom r ...
- (转)C#操作Word文档
原文1地址:http://www.cnblogs.com/lantionzy/archive/2009/10/23/1588511.html 原文2地址: http://www.cnblogs.com ...
- PYTHON语言书库
<SELENIUM 2 自动化测试实战 基于PYTHON语言>pdf 附下载链接 本书下载链接:https://pan.baidu.com/s/1A1s6UHecXd1Z465zbLumh ...
- wordpress写文章添加gif图片变成静态图片的解决办法
添加文章时gif只能静态,记得在添加时选择完整尺寸,不要压缩即可
- css动画animation-keyframes
随着css3的流行,现在很多可以使用css3实现的动画效果,基本上就选择css3实现,尤其是在移动端的(移动端对css3的支持度相对比较高,PC端有很多IE8及以下的浏览器拖着后腿呢). 最近做了一个 ...