 # SGSTW-Editorial

Author: Shreyansh Narayan
Tester: Shreyansh Narayan
Editorialist: Pranjal Tank

Easy

# Problem:

There are a total of 3 teams – A, B, and C, having three members each. The weights of all the members is given. The strength of a team is the average of weight of all the members of a team. If the strength of any one team is greater than that of other teams, then there is a “Winner” . Else, there exists “No Winner” . Your task is to return whether there exists a winner or not.

# EXPLANATION:

• For each team we have to sum up the strength of each member and take its average
• Then we store this average in a variable of float data type.
• After that we will Compare the average of all the team and the team having highest average will be declared as Winner.

# TIME COMPLEXITY:

The time complexity for the above problem will be O(1).

# SOLUTION:

Editorialist's Solution
``````#include<bits/stdc++.h>
using namespace std;
int main(){

int t;
cin>>t;
while(t--){

int a;
float b={0};
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cin>>a[i][j];
b[i]+=(a[i][j]);
}
b[i]=b[i]/3;
}
sort(b,b+3);
if(b!=b){
cout<<"winner"<<endl;
}
else{
cout<<"no winner"<<endl;
}
}
return 0;
}
``````