Dominant Army solution codechef

Dominant Army solution codechef

In the medieval age, there were 33 kingdoms AABB, and CC. The army of these kingdom had NANANBNB, and NCNC soldiers respectively.

You are given that an army with XX soldiers can defeat an army with YY soldiers only if X>YX>Y.

An army is said to be dominant if it can defeat both the other armies combined. For example, kingdom CC‘s army will be dominant only if NC>NA+NBNC>NA+NB.

Determine whether any of the armies is dominant or not.

Input Format

Dominant Army solution codechef

  • The first line contains a single integer TT – the number of test cases. Then the test cases follow.
  • The first and only line of each test case contains three integers NANANBNB, and NCNC – the number of warriors in the armies of kingdoms AABB, and CC respectively.

Output Format

For each test case, output YES if any of the armies is dominant. Otherwise, output NO.

You may print each character of YES and NO in uppercase or lowercase (for example, yesyEsYes will be considered identical).

Constraints

Dominant Army solution codechef

  • 1T10001≤T≤1000
  • 1NA,NB,NC1001≤NA,NB,NC≤100

Sample Input 1

4
15 5 6
12 13 16
1 1 100
10 10 20

Sample Output 1

YES
NO
YES
NO

Explanation

Test case 11: The kingdom AA‘s army is dominant since 15>5+615>5+6.

Test case 22: We can observe that none of the armies is dominant.

Test case 33: The kingdom CC‘s army is dominant since 100>1+1100>1+1.

Test case 44: We can observe that none of the armies is dominant. Note that the kingdom CC‘s army is not dominant since 2010+1020≤10+10.

Dominant Army solution codechef

Leave a Comment