Monday, February 21, 2022

Peaceful Party

 The mayor of your city has decided to throw a party to gather the favour of his people in different regions of the city.

There are 3 distinct regions in the city namely ABC comprising of PAPB and PC number of people respectively.

However, the mayor knows that people of the region B are in conflict with people of regions A and C. So, there will be a conflict if people from region B are present at the party along with people from region A or C.

The mayor wants to invite as many people as possible and also avoid any conflicts. Help him invite maximum number of people to the party.

Input Format

  • The first line contains a single integer T - the number of test cases. Then the test cases follow.
  • The first line of each test case contains three integers PAPB and PC - number of people living in regions AB and C respectively.

Output Format

For each test case, output the maximum number of people that can be invited to the party.

Constraints

  • 1T1000
  • 1PA,PB,PC1000

Sample Input 1 

3
2 3 4
1 5 2
8 8 8

Sample Output 1 

6
5
16

Explanation

Test case-1: Mayor can invite all the people from region A and C. So the maximum number of people invited is 6.

Test case-2: Mayor can invite all the people from region B. So the maximum number of people invited is 5.

No comments:

Post a Comment

मुझे दिल में बसाना आसान नहीं....

पता है Recently i realised की मुझे दिल में बसाना आसान नहीं है बात-बात पे चिढ़ जाती हूं मैं दिल लगा लूं एक बार तो फिर ज़िद पे अड़...