Problem description | | Progress |
Темы:
structures
Strings
Find the average score of all students in each subject.
Input
The first line specifies the number of students n (\(0 < n <=100\)). Followed by n lines, each of which contains the last name, first name and three numbers (grades in three subjects: mathematics, physics, computer science). The data in a line is separated by a single space. Grades take values from 1 to 5.
Output
Print three real numbers, separating them with one space: the average score of all students in mathematics, physics, computer science.
Examples
# |
Input |
Output |
1 |
2
Markov Valeriy 4 5 2
Kozlov Georgiy 5 1 2
|
4.5 3 2 |
| |
|
Темы:
structures
Using sort
Elementary geometry
Print all initial points in ascending order of their distances from the origin.
Create a Point structure and store the original data in an array of Point structures.
Input
The program receives a set of points on the plane as input. First, the number of points n is given, then there is a sequence of n lines, each of which contains two numbers: the coordinates of the point. The value of n does not exceed 100, all initial coordinates – integers not exceeding 103.
Imprint
It is necessary to display all initial points in ascending order of their distances from the origin. The program displays only the coordinates of the points, there is no need to display their number.
Examples
# |
Input |
Output |
1 |
2
1 2
2 3
| 1 2
2 3
|
| |
|
Темы:
Strings
structures
Print the last names and first names of students who do not have triples (as well as twos and stakes).
Input
First, the number of students n is given, then n lines, each of which contains the last name, first name and three numbers (grades in three subjects: mathematics, physics, computer science). The data in a line is separated by a single space. Ratings take a value from 1 to 5.
Imprint
It is necessary to output pairs of surname-first name, one per line, separating the surname and first name with one space. No ratings required. The output order must be the same as in the original data.
Examples
# |
Input |
Output |
1 |
3
Babat Anna 5 4 3
Belova Galina 4 3 5
Moroz Yaroslav 3 5 4 |
|
| |
|
Темы:
Strings
structures
Identify the three students with the best GPA in three subjects. Print the first and last names of these students. If at the same time, several students have the same average score as the average score of the student who "took 3rd place", then you need to print them all.
Input
First, the number of students n is given, then n lines, each of which contains the last name, first name and three numbers (grades in three subjects: mathematics, physics, computer science). The data in a line is separated by a single space. Ratings take a value from 1 to 5.
Imprint
It is necessary to output pairs of surname-first name, one per line, separating the surname and first name with one space. No ratings required. The output order must be the same as in the original data.
Examples
# |
Input |
Output |
1 |
3
Yakovlev Ivan 5 5 5
Yapryntsev Aleksey 5 5 5
Kozlov Georgiy 5 5 5 |
Yakovlev Ivan
Yapryntsev Aleksey
Kozlov Georgiy |
| |
|
Темы:
Strings
structures
Print the last and first names of students in descending order of their GPA.
Input
First, the number of students n is given, then n lines, each of which contains the last name, first name and three numbers (grades in three subjects: mathematics, physics, computer science). The data in a line is separated by a single space. Ratings take a value from 1 to 5.
The total number of students does not exceed 100001.
Imprint
It is necessary to output pairs of surname-first name, one per line, separating the surname and first name with one space. No ratings required. If several students have the same average scores, then they should be output in the order specified in the input data.
Examples
# |
Input |
Output |
1 |
2
Markov Valeriy 1 1 1
Ivanov Ivan 2 2 2 |
Ivanov Ivan
Markov Valeriy |
2 |
3
Markov Valeriy 5 5 5
Sergey Petrov 1 1 1
Petrov Petr 3 3 3 |
Markov Valeriy
Petrov Petr
Sergey Petrov |
| |
|