Greater Average CodeChef Solution

Problem – Greater Average CodeChef Solution

You are given 33 numbers A, B,A,B, and CC.

Determine whether the average of AA and BB is strictly greater than CC or not?

NOTE: Average of AA and BB is defined as \frac{(A+B)}{2}2(A+B)​. For example, average of 55 and 99 is 77, average of 55 and 88 is 6.56.5.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of 33 integers A, B,A,B, and CC.

Output Format

For each test case, output YES if average of AA and BB is strictly greater than CCNO otherwise.

You may print each character of the string in uppercase or lowercase (for example, the strings YeSyEsyes and YES will all be treated as identical).

Constraints

  • 1 \leq T \leq 10001≤T≤1000
  • 1 \leq A, B, C \leq 101≤A,B,C≤10

Sample 1:

Input: 5
5 9 6
5 8 6
5 7 6
4 9 8
3 7 2
Output: YES
YES
NO
NO
YES

Explanation:

Test case 11: The average value of 55 and 99 is 77 which is strictly greater than 66.

Test case 22: The average value of 55 and 88 is 6.56.5 which is strictly greater than 66.

Test case 33: The average value of 55 and 77 is 66 which is not strictly greater than 66.

Test case 44: The average value of 44 and 99 is 6.56.5 which is not strictly greater than 88.

Test case 55: The average value of 33 and 77 is 55 which is strictly greater than 22.

Greater Average CodeChef Solution in Java

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner my = new Scanner(System.in);
        int cases = my.nextInt();
        int a,b,c;
        double ave;
        for(int i =0;i<cases; i++)
        {
            a = my.nextInt();
            b = my.nextInt();
            c = my.nextInt();
            ave = (a+b)/2.0;
            
            if(ave>c)
            System.out.println("YES");
            
            else
            System.out.println("NO");
            
        }
    }
}

Greater Average CodeChef Solution in Pyth 3

# cook your dish here
for i in range(int(input())):
    a,b,c=map(int,input().split())
    if(((a+b)/2)>c):
        print('YES')
    else:
        print('NO')

Greater Average CodeChef Solution in C++14

#include <bits/stdc++.h>
using namespace std;
void fun(){
     float A,B,C;
        cin>>A>>B>>C;
        if((A+B)/2>C)
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;
    
}

signed main() {
    int T;
    cin>>T;
    while(T--){
        
        fun();
    }
	
	
}

Greater Average CodeChef Solution Review:

In our experience, we suggest you solve this Greater Average CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Greater Average CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Greater Average CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.