# PROBLEM LINK:

**Setter:** inov_360

**Testers:** iceknight1093 , jeevanjyot

**Editorialist:** kiran8268

# DIFFICULTY:

627

# PREREQUISITES:

None

# PROBLEM:

Chef has four ingredients A, B, C and D with tastiness a, b, c, and d respectively. He can use either A or B as the first ingredient and either C or D as the second ingredient. The tastiness of a dish is the sum of tastiness of its ingredients. Find the **maximum** possible tastiness of the dish that the chef can prepare.

# EXPLANATION:

Given, the testiness of the dish is the sum of the testiness of the ingredients. Also, out of 4 ingredients only two are used at a time. That is either A or B is used as the first ingredient and C or D is used as the second ingredient.

Thus the testiness of the dish is: Testiness of (A or B) + Testiness of (C or D).

Our objective is to find the maximum testiness, thus our desired output is:

Max(A or B) + Max (C or D).

# TIME COMPLEXITY:

Time complexity is O(1).

# SOLUTION:

## Editorialist's Solution

```
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<max(a,b)+max(c,d)<<"\n";
}
```