CF1422A.Fence

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths aa, bb, and cc. Now he needs to find out some possible integer length dd of the fourth straight fence segment so that he can build the fence using these four segments. In other words, the fence should have a quadrilateral shape with side lengths equal to aa, bb, cc, and dd. Help Yura, find any possible length of the fourth side.

A non-degenerate simple quadrilateral is such a quadrilateral that no three of its corners lie on the same line, and it does not cross itself.

尤拉需要建造一个封闭的围栏,其形状为任意非退化简单四边形。他已有三段已知长度的直栅栏,长度分别为 aa、bb 和 cc。现在他需要找出第四段直栅栏可能的整数长度 dd,使得这四段栅栏能构成一个四边形围栏。换言之,该围栏应是一个边长分别为 aa、bb、cc 和 dd 的四边形。请帮助尤拉,找出任意一个满足条件的第四边长度。

非退化简单四边形是指其任意三个顶点不共线,且自身不相交的四边形。

输入格式

The first line contains a single integer tt — the number of test cases (1≤t≤10001 \le t \le 1000). The next tt lines describe the test cases.

Each line contains three integers aa, bb, and cc — the lengths of the three fence segments (1≤a,b,c≤1091 \le a, b, c \le 10^9).

第一行包含一个整数 tt —— 测试用例的数量(1≤t≤10001 \le t \le 1000)。接下来的 tt 行描述各个测试用例。

每行包含三个整数 aa、bb 和 cc —— 三条栅栏段的长度(1≤a,b,c≤1091 \le a, b, c \le 10^9)。

输出格式

For each test case print a single integer dd — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists.

对于每个测试用例,输出一个整数 dd —— 适合建造围栏的第四段围栏的长度。如果存在多个答案,输出任意一个即可。我们可以证明答案一定存在。

输入输出样例

  • 输入#1

    2
    1 2 3
    12 34 56

    输出#1

    4
    42

说明/提示

We can build a quadrilateral with sides 11, 22, 33, 44.

We can build a quadrilateral with sides 1212, 3434, 5656, 4242.

我们可以用边长为 11、22、33、44 的四条边构成一个四边形。
我们可以用边长为 1212、3434、5656、4242 的四条边构成一个四边形。

输入解题思路,AI测评打分。不知道怎么写?

首页