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;
    }
    
  • 相关阅读:
    sudo
    Ansible模块
    Ansible自动化运维
    Sersync
    eclipse报错MA
    myeclipse报错MA
    通过StringBuilder的reverse()实现倒序
    位运算实现高效互换
    scanf("%s",s)与gets(s)
    异或运算符实现简单加密
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798907.html
Copyright © 2011-2022 走看看