My issue
my approach is that i find the sum of the arrays and then compare with if conditions but my 1 output is wrong
My code
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n];
int b[n];
for(int i=0;i<n;i++){
cin>>a[i];
cin>>b[i];
}
int omsum=0;
int addysum=0;
for(int i=0;i<n;i++){
omsum=omsum+a[i];
addysum=addysum+b[i];
}
if(omsum>addysum)
cout<<"om"<<'\n';
else if(omsum=addysum)
cout<<"draw"<<'\n';
else
cout<<"addy"<<'\n';
}
// your code goes here
return 0;
}
Learning course: Arrays using C++
Problem Link: CodeChef Streak Practice Problem in - CodeChef