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;
    }
    
  • 相关阅读:
    正则表达式随笔
    linux 命令大全
    oracle merge into
    存储过程else if
    存储过程 loop
    存储过程 函数
    存储过程使用集合来存储查询
    存储过程使用游标和索引
    存储过程使用%rowtype定义游标类型的变量提取emp数据
    ORACLE 存储过程 like 样例
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798907.html
Copyright © 2011-2022 走看看