學生成績管理
假設有一個班級的學生n人,期末考試老師要對成績從高到低列出,并對各科的考試成績求出其最高分、最低分和平均成績。現在設計一個成績管理程序,能夠實現以下的功能:
(1)對某門科目的成績進行排序并顯示輸出;
(2)求出每門科目的最高分、最低分和平均分的信息;
學生成績的數據用結構數組表示,包括:學號、姓名、三門科目的考試成績,其結構格式如下:
學號 姓名 語文 數學 外語 C++
int num char name[10] int score[4]
Input
The input consists of two lines. The first line contains two integers n and k which are the lengths of the array and the sliding window. There are n integers in the second line.
Output
There are two lines in the output. The first line gives the minimum values in the window at each position, from left to right, respectively. The second line gives the maximum values.
Sample Input
8 3
1 3 -1 -3 5 3 6 7
Sample Output
-1 -3 -3 -3 3 3
3 3 5 5 6 7