Entity303 @ 2018-10-30 19:16:36
#include<bits/stdc++.h>
using namespace std;
int n;
struct t
{
int number;
int math;
int chinese;
int english;
int score;
}a[302];
int main()
{
freopen(".in","r",stdin);
freopen(".out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i].chinese>>a[i].math>>a[i].english;
a[i].score=a[i].chinese+a[i].math+a[i].english;
a[i].number=i;
}
for(int i=n-1;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
if(a[j].score<a[j+1].score)
{
swap(a[j],a[j+1]);
}
else if(a[j].score==a[j+1].score)
{
if(a[j].chinese<a[j+1].chinese)
{
swap(a[j],a[j+1]);
}
else if(a[j].chinese==a[j+1].chinese)
{
if(a[j].number>a[j+1].number)
{
swap(a[j],a[j+1]);
}
}
}
}
}
for(int i=1;i<=5;i++)
{
cout<<a[i].number<<" "<<a[i].score<<endl;
}
return 0;
}
by Entity303 @ 2018-10-30 19:16:53
求助
by WA鸭鸭 @ 2018-10-30 19:17:38
@Entity303 freopen删掉
by Eason_AC @ 2018-10-30 19:17:51
哦对
by Entity303 @ 2018-10-30 19:18:24
额,这就尴尬了
by Rbu_nas @ 2018-10-30 19:18:27
@Entity303 您打了freopen还有10分,%%%
by WA鸭鸭 @ 2018-10-30 19:19:06
@Rem° 是0分好像
by 杨咩咩咩啊 @ 2018-10-30 19:24:46
居然还有十分??%%%%%%%
by BinDir0 @ 2018-10-30 19:25:45
@Entity303 %%%%%%%%%10分
by ღ夜刀神十香 @ 2018-10-30 19:25:53
神奇
by Entity303 @ 2018-10-30 19:44:20
@WA鸭鸭 emmm我这是10分