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 ...
随机推荐
- 记录Linux下解压大文件时的一次奇葩经历
由于需要安装新的系统,使用wget下载tar包,8G多下载了1个多小时.解压完后的文件夹中的tar包数量明显不够,而且原始的tar包竟然不见了. 同样的操作又进行了一次,结果还是一样,不得不怀疑是哪里 ...
- android-menudrawer 和SlidingMenu 用法
项目地址: https://github.com/gokhanakkurt/android-menudrawer https://github.com/jfeinstein10/SlidingM ...
- F5负载均衡原理(转载)
https://blog.csdn.net/panxueji/article/details/42647193 一. 负载均衡技术 负载均衡技术在现有网络结构之上提供了一种廉价.有效.透明的方法,来扩 ...
- Android 通过联系人姓名查询联系人号码
<!-- 读联系人权限 --><uses-permission android:name="android.permission.READ_CONTACTS" / ...
- mysql 中 myisam innodb 的区别
区别: 1. InnoDB支持事务,MyISAM不支持,对于InnoDB每一条SQL语言都默认封装成事务,自动提交,这样会影响速度,所以最好把多条SQL语言放在begin和commit之间,组成一个事 ...
- MYSQL存储过程中 使用变量 做表名
); DECLARE temp2 int; set temp1=m_tableName; set temp2=m_maxCount; set @sqlStr=CONCAT('select * from ...
- python多进程与服务器并发
进程 什么是进程 进程:正在进行的一个过程或者说一个任务.而负责执行任务则是cpu. 进程与程序的区别 程序仅仅只是一堆代码而已,而进程指的是程序的运行过程. 并发与并行 无论是并行还是并发,在用户看 ...
- selenium在scrapy中的应用
引入 在通过scrapy框架进行某些网站数据爬取的时候,往往会碰到页面动态数据加载的情况发生,如果直接使用scrapy对其url发请求,是绝对获取不到那部分动态加载出来的数据值.但是通过观察我们会发现 ...
- 禁用SSL v2.0、SSL v3.0协议
1.禁用SSL v2.0.SSL v3.0协议,禁用低强度加密密钥.使用TLS 1 TLSv1.1 TLSv1.2版本.2.禁用SSLv2参考修补方法如下:查看本机sslv3加密列表:openssl ...
- Linux系统及常用软件的安装
注释:看了很多人说在Windows下面跑机器学习就和大人一直用勺子吃饭一样,应该用更...刚写到这里Linux又奔溃了-- 以后就在Linux上跑程序了,告别Windows的时代... 别看下面的安装 ...