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;
    }
    
  • 相关阅读:
    模拟Promise
    js 重写concat
    js 重写 slice
    es6继承
    es5 简单继承
    iterator 和yield的关系
    iterator接口 ...和for of依赖的关键
    e.offsetX,Y到底是相对于谁
    mysql alter修改数据库表结构用法
    mysql修改表结构
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798906.html
Copyright © 2011-2022 走看看