zoukankan      html  css  js  c++  java
  • CodeForces

    B. Cover Points
    time limit per test1 second
    memory limit per test256 megabytes
    inputstandard input
    outputstandard output
    There are n points on the plane, (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 n (1≤n≤105).

    Each of the next n lines contains two integers xi and yi (1≤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
    inputCopy
    3
    1 1
    1 2
    2 1
    outputCopy
    3
    inputCopy
    4
    1 1
    1 2
    2 1
    2 2
    outputCopy
    4
    Note
    Illustration for the first example:
    在这里插入图片描述
    Illustration for the second example:

    在这里插入图片描述
    题意是找一个三角形把所有点都覆盖,求等腰三角形最短边长。额他的长度因为是等腰直角三角型,很奇怪,最大的X+Y正好是最短边长。

    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n,a,b,max2=0;
        cin>>n;
        while(n--)
        {
            scanf("%d %d",&a,&b);
            max2=max(a+b,max2);
        }
        cout<<max2<<endl;
        return 0;
    }
    
  • 相关阅读:
    JavaScript Date 对象
    javascript Array类型 方法大全
    Flexbox
    CSS 去除浏览器默认 轮廓外框
    多行文本溢出显示省略号(…) text-overflow: ellipsis
    最全CSS3选择器
    何时使用 Em 与 Rem
    前端笔试面试题
    oracle中 lob类型
    MySQL 5.5.62 安装方法(标准配置版)
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798907.html
Copyright © 2011-2022 走看看