學(xué)生成績管理
假設(shè)有一個班級的學(xué)生n人,期末考試?yán)蠋熞獙Τ煽儚母叩降土谐觯Ω骺频目荚嚦煽兦蟪銎渥罡叻?、最低分和平均成績。現(xiàn)在設(shè)計一個成績管理程序,能夠?qū)崿F(xiàn)以下的功能:
(1)對某門科目的成績進(jìn)行排序并顯示輸出;
(2)求出每門科目的最高分、最低分和平均分的信息;
學(xué)生成績的數(shù)據(jù)用結(jié)構(gòu)數(shù)組表示,包括:學(xué)號、姓名、三門科目的考試成績,其結(jié)構(gòu)格式如下:
學(xué)號 姓名 語文 數(shù)學(xué) 外語 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