Skip to content

Commit

Permalink
Merge pull request #29 from ows-ali/ows-ali-patch-1
Browse files Browse the repository at this point in the history
Add problem in Codechef, reference #1
  • Loading branch information
ows-ali authored Oct 17, 2018
2 parents f6c3cb5 + 2dfcd87 commit 456cd7c
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Hackerrank/COOK82A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include<stdio.h>
#include<stdlib.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{

int numofiterations;
scanf("%d", &numofiterations);
int i,j;//loopnig variables
char teamname[30];

int goals[4];

int teamgoals;
for (i=0;i<numofiterations;i++)
{
for (j=0;j<4;j++)
{
cin>>teamname>>teamgoals;

if (strcmp(teamname,"Barcelona")==0 )
{
goals[0]=teamgoals;
}
else if(strcmp(teamname,"Malaga")==0)
{
goals[1]=teamgoals;
}
else if(strcmp(teamname,"RealMadrid")==0)
{
goals[2]=teamgoals;
}
else //if(teamname=="Eibar")
{
goals[3]=teamgoals;
}
}

if (goals[1]>goals[2] && goals[0]>goals[3])
{
printf("Barcelona\n");
}
else
printf("RealMadrid\n");
}


}

0 comments on commit 456cd7c

Please sign in to comment.