#include<stdio.h>
#include<malloc.h>
#define SIZE sizeof(struct stu)
struct stu{
int num;
char name[20];
float mscore;
float yscore;
struct stu *next;
};
void main()
{
int n=0;
float summ=0,sumy=0;
struct stu *head,*p1,*p2,*maxm,*maxy;
p1=p2=(struct stu*)malloc(SIZE);
scanf("%d%s%f%f",&p1->num,p1->name,&p1->mscore,&p1->yscore);
head=NULL;
while(p1->num!=0)
{
n=n+1;
if(n==1) head=p1;
else p2->next=p1;
p2=p1;
p1=(struct stu*)malloc(SIZE);
scanf("%d%s%f%f",&p1->num,p1->name,&p1->mscore,&p1->yscore);
}
p2->next=NULL;
maxm=maxy=p1=head;
while(p1!=NULL)
{
summ=summ+p1->mscore;
sumy=sumy+p1->yscore;
if(maxm->mscore<p1->mscore) maxm=p1;
if(maxy->yscore<p1->yscore) maxy=p1;
p1=p1->next;
}
printf("数学平均分:%.2f\n",summ/n);
printf("语文平均分:%.2f\n",sumy/n);
printf("数学最高分:%s %.2f\n",maxm->name,maxm->mscore);
printf("语文最高分:%s %.2f",maxy->name,maxy->yscore);
}