#include "stdio.h"
#include "stdlib.h"
struct Student{
int num;
char name[20];
double score[3];
double avg;
};
struct Node{
struct Student stu;
struct Node *next;
};
struct Node* Avg(struct Node* p);
struct Node* Max(struct Node *p);
struct Node* Dele(struct Node *p,int site);
int main(){
int i;
struct Node *n,*p,*max,*head=NULL;
n=(struct Node*)malloc(sizeof(struct Node));
scanf("%d%s%lf%lf%lf",&n->stu.num,n->stu.name,&n->stu.score[0],&n->stu.score[1],&n->stu.score[2]);
n->next=NULL;
p=n;
head=n;
for(i=0;i<3;i++){
n=(struct Node*)malloc(sizeof(struct Node));
scanf("%d%s%lf%lf%lf",&n->stu.num,n->stu.name,&n->stu.score[0],&n->stu.score[1],&n->stu.score[2]);
n->next=NULL;
p->next=n;
p=n;
}
printf("\n");
p=Avg(head);
p=Dele(p,102);
for(;p!=NULL;p=p->next){
printf("学号:%d 姓名:%s 平均分:%lf\n",p->stu.num,p->stu.name,p->stu.avg);
}
return 0;
}
struct Node* Avg(struct Node* p){
int i;
double sum;
struct Node *q=p;
for(;p!=NULL;p=p->next){
sum=0;
for(i=0;i<3;i++){
sum+=p->stu.score[i];
}
p->stu.avg=sum/3;
}
return q;
}
struct Node *Max(struct Node *p){
struct Node *max;
max=p;
for(;p!=NULL;p=p->next){
if(max->stu.avg<p->stu.avg)
max=p;
}
return max;
}
struct Node* Dele(struct Node *p,int site){
int i=1,j;
struct Node *q=p;
for(;p!=NULL;p=p->next,i++){
if(p->stu.num==site)
break;
}
if(i==1){
return p->next;
}else{
for(j=1,p=q;p!=NULL;p=p->next,j++){
if(j==i-1){
p->next=p->next->next;
break;
}
}
return q;
}
}