#P3002. CAIE IGCSE CS February/March 2023 Paper 22 Problem 11
CAIE IGCSE CS February/March 2023 Paper 22 Problem 11
The one-dimensional (1D) array contains the names of teams in a sports league.
The two-dimensional (2D) array contains the points awarded for each match.
The position of each team’s data in the two arrays is the same. For example, the team stored at
index 10 in and is the same.
The variable contains the number of teams in the league. The variable
contains the number of matches played. All teams have played the same number of matches.
Each match can be played at home or away. Points are recorded for the match results of each
team with the following values:
- 3 – away win
- 2 – home win
- 1 – drawn match
- 0 – lost match.
Write a program that meets the following requirements
- calculates the total points for all matches played for each team
- counts the total number of away wins, home wins, drawn matches and lost matches for each team
- outputs for each team: – name – total points – total number of away wins, home wins, drawn matches and lost matches
- finds and outputs the name of the team with the highest total points
- finds and outputs the name of the team with the lowest total points.
The data guarantees that no team has the same results
INPUT FORMAT
The first line contains , the LeagueSize, , the the Number of matches
The second line contains Leagues' names
The third line to line, for each league contains matches in each line
OUTPUT FORMAT
For each league output 6 lines
- First line:
Nameand Name - Second line:
Total pointsand total points - Third line:
Total number of away winsand total number of away wins - Fourth line:
Total number of home winsand total number of home wins - Fifth line:
Total number of drawn matchesand total number of drawn matches - Sixth line:
Total number of lost matchesand total number of lost matches
And each line for the name of the team with the highest total points and the lowest total points
- First line:
Highest total pointsand the teams with the highest total points - Second line:
Lowest total pointsand the teams with the lowest total points
You should declare all variables you used
SAMPLE
INPUT
6 5
Arsenal Barcelona Bayern_Munich Juventus Liverpool Real_Madrid
3 3 3 3 3
3 3 3 3 2
3 3 3 2 2
3 3 2 2 2
3 2 2 2 2
2 2 2 2 2
OUTPUT
Name Arsenal
Total points 15
Total number of away wins 5
Total number of home wins 0
Total number of drawn matches 0
Total number of lost matches 0
Name Barcelona
Total points 14
Total number of away wins 4
Total number of home wins 1
Total number of drawn matches 0
Total number of lost matches 0
Name Bayern_Munich
Total points 13
Total number of away wins 3
Total number of home wins 2
Total number of drawn matches 0
Total number of lost matches 0
Name Juventus
Total points 12
Total number of away wins 2
Total number of home wins 3
Total number of drawn matches 0
Total number of lost matches 0
Name Liverpool
Total points 11
Total number of away wins 1
Total number of home wins 4
Total number of drawn matches 0
Total number of lost matches 0
Name Real_Madrid
Total points 10
Total number of away wins 0
Total number of home wins 5
Total number of drawn matches 0
Total number of lost matches 0
Highest total points Arsenal
Lowest total points Real_Madrid