#include<stdio.h>
struct rec
{
int number;
char name[26];
float score[4];
};
void input(struct rec a[]);
float average(struct rec a[]);
int max(struct rec a[]);
int main()
{
struct rec student[5];
int i,m;
float ave;
input( student );
ave=average( student );
m=max( student );
printf("%.2f\n",ave);
printf("%d\n",student[m].number);
printf("%s\n",student[m].name);
for(i=0;i<3;i++)
printf("%.2f\n",student[m].score[i]);
printf("%.2f\n",student[m].score[3]);
return 0;
}
void input(struct rec a[])
{
int i,j;
for(i=0;i<5;i++)
{
scanf("%d",&a[i].number);
gets( a[i].name );
for(j=0;j<3;j++)
scanf("%f",&a[i].score[j]);
}
}
float average(struct rec a[])
{
int i,j;
float s=0,sum;
for(i=0;i<5;i++)
{
sum=0;
for(j=0;j<3;j++)
{
sum+=a[i].score[j];
s+=a[i].score[j];
}
a[i].score[3]=sum/3;
}
return s/15;
}
int max(struct rec a[])
{
int i,j;
float max;
max=a[0].score[3];
for(i=0;i<5;i++)
{
if(max>a[i].score[3])
{
max=a[i].score[3];
j=i;
}
}
return j;
}