PROBLEM LINK:
Author: Hussain Kara Fallah
Primary Tester: Hasan Jaddouh
Secondary Tester: Istvan Nagi
Editorialist: Udit Sanghi
DIFFICULTY:
CAKEWALK
PREREQUISITES:
None
PROBLEM:
There are 2 matches to be held in the final round of La Liga(a football season/tournament) which determine the winner of the tournament. In order for Barcelona to win the title,it must win its game and Real Madrid must lose its game. Given the goals scored by each of the teams in both the matches, tell who is going to win the title.
QUICK EXPLANATION:
Store the number of goals scored by each of the team. See who wins the matches between the teams and check if the given condition is true.
EXPLANATION:
So the first step will idealy be to store the scores of each team.
Now you have the scores of each team. So you need to check -
1. Barcelona won its game: We can check this if barca > eibar.
2. Real Madrid loses to Malaga: We can check this if real < malaga
So if these 2 conditions are true then the answer is ‘Barcelona’ else it is ‘RealMadrid’.
EDITORIALIST’s, AUTHOR’S AND TESTER’S SOLUTIONS:
EDITORIALIST’s solution: [Here] 111
AUTHOR’s solution: [Here] 222
TESTER’s solution: [Here] 333