Superbia_zyb @ 2016-05-21 12:40:47
#include<stdio.h>
int xuhao[301];
int yuwen[301];
int shuxue[301];
int waiyu[301];
int zongshu[301];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
xuhao[i]=i;
scanf("%d%d%d",&yuwen[i],&shuxue[i],&waiyu[i]);
zongshu[i]=yuwen[i]+shuxue[i]+waiyu[i];
}
int t1=0;
int t2=0;
for(int j=1;j<=n;j++)
{
for(int i=n;i>j;i--)
{
if(
(zongshu[i]>zongshu[i-1])||
(
zongshu[i]==zongshu[i-1]&&
yuwen[i]>yuwen[i-1] )||
(
zongshu[i]==zongshu[i-1]&&
yuwen[i]==yuwen[i-1]&&
xuhao[i]<xuhao[i-1]
) )
{
t1=zongshu[i];
zongshu[i]=zongshu[i-1];
zongshu[i-1]=t1;
t2=xuhao[i];
xuhao[i]=xuhao[i-1];
xuhao[i-1]=t2;
}
}
}
for(int i=1;i<=5;i++)
{
printf("%d ",xuhao[i]);
printf("%d\n",zongshu[i]);
}
}
by 笑你个毛 @ 2016-09-26 19:01:39
饿,你用scanf和printf应该调用cstdio吧