#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
freopen("score.in","r",stdin);
freopen("score.out","w+",stdout);
struct student
{
char name[10];
int id;
int mid, final, usual;
double term;
} a[100]={0}, b;
int i,n,j,k,max;
scanf("%d", &n);
for(i=0;i<n;i++)
{
scanf("%s %d %d %d %d", &a[i].name, &a[i].id, &a[i].mid, &a[i].final, &a[i].usual);
a[i].term = (a[i].mid + a[i].final)*0.3 + a[i].usual*0.4;
}
printf("\n\n***所有資料輸出***\n");
for(i=0;i<n;i++)
{
printf("%s %d %d %d %d\n", a[i].name, a[i].id, a[i].mid, a[i].final, a[i].usual);
printf("term score: %.1lf\n\n", a[i].term);
}
for(i=0;i<n;i++)
{
max=i;
for(j=i+1;j<n;j++)
{
if(a[j].term > a[max].term)
max=j;
}
b=a[i];
a[i]=a[max];
a[max]=b;
}
printf("\n\n***成績高低排序***\n");
for(i=0;i<n;i++)
{
printf("第%d名:%s %d %d %d %d\n", i+1, a[i].name, a[i].id, a[i].mid, a[i].final, a[i].usual);
printf("term score: %.1lf\n\n", a[i].term);
}
system("pause");
return 0;
}