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;
    }
    
  • 相关阅读:
    单个 js 文件禁用 ESLint 语法校验
    meta标签整合
    安装es6编译babel
    JSON.parse()和JSON.stringify()的区别
    preventDefault()、stopPropagation()、return false 的区别
    excel 表格内容读取
    redis 小例
    多文件打包下载
    随笔
    js数组删除元素
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798906.html
Copyright © 2011-2022 走看看