CodeForces1422A

题意

给出T组数据,每组数据给出a、b、c三条边,要求我们求出一条边d,使这四条边可以构成一个四边形。

注意:自己的代码输出答案不一定要和题目给的样例的输出一样,输出任何一个可能的长度即可。

思路

直接取a、b、c的最大值即可。

AC代码

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int a,b,c;
        cin>>a>>b>>c;
        int x=max(a,b),d=max(x,c);
        cout<<d<<endl;
    }
    return 0;
}
原文地址:https://www.cnblogs.com/OFSHK/p/13794872.html