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 ...
随机推荐
- [UE4]IsValid方法妙用
由于UE4中各个对象的创建顺序无法保证,因此可以使用IsValid方法判断一个对象是否有效,如果无效则初始化,如果有效则直接可以使用.
- mysql 5.7主从库复制设置
先要修改配置文件,重启mysql服务 log-bin= mysql-binlog # 打开二进制日志 ,最好放在不同的硬盘上,减小 IO 消耗 expire_logs_day= # 设置二进制日志保存 ...
- IntelliJ IDEA 版本控制器 - Git
1.下载Git 2.测试Git是否安装成功 3.设置 本机 Git 标识,同时解决未设置标识产生的错误 Successfully created project 'demo' on GitHub, b ...
- tips:Java中的switch的选择因子
tips:Java中的switch的选择因子! /* switch(){ } */ switch的()中的判断条件能是什么类型呢? 事实上,在我们学习c++的了解中,switch的参数是一个能 ...
- BZOJ2560串珠子
/* 很清新的一道题(相比上一道题) g[S]表示该 S集合中胡乱连的所有方案数, f[S] 表示S集合的答案 那么F[S] 等于G[S]减去不合法的部分方案 不合法的方案就枚举合法的部分就好了 g[ ...
- svn下copy项目后定位到新资源库,产生不同版本号的方法
转载于http://blog.csdn.net/u012990533/article/details/44776465 最近这两天,公司要做国际化的开发,本打算要用struts2内置的i18n拦截器做 ...
- 转载:centos安装redis
转载自:https://www.cnblogs.com/renzhicai/p/7773080.html CentOS下Redis的安装 [TOC] 前言 安装Redis需要知道自己需要哪个版本,有针 ...
- Missing artifact javax.transaction:jta:jar:1.0.1B
下载https://pan.baidu.com/s/1hsfyj8S到某目录,比如: /Users/yintingting/Downloads 打开terminal,cd /Users/yinting ...
- python零散补充与总结
一 有一种情况,在Windows系统上面有一个文件,编码为gbk,将其上传到Linux虚拟机,系统编码为utf-8, 使用cat命令查看时是乱码,这时如何解决? [root@localhost ~]# ...
- gentoo eclipse swt
最近学习使用 eclipse rcp 来做一些插件. 首先下载安装 eclipse-rcp,然后安装 swt emerge -av swt 安装完成以后, 在 /usr/portage/distfil ...