-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ows-ali/ows-ali-patch-1
Add problem in Codechef, reference #1
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
||
|
||
} |