- 奖学金
- 2017-10-01 13:57:25 @
#include<bits/stdc++.h>
using namespace std;
int b[120];
struct student
{
int y;
int s;
int e;
int z;
}a[120];
int main()
{
int n,i,l,j;
cin>>n;
for (i=1;i<=n;i++)
{
cin>>a[i].y>>a[i].s>>a[i].e;b[i]=i;
a[i].z=a[i].y+a[i].s+a[i].e;}
for (i=1;i<=n-1;i++)
for (j=1;j<=n-i;j++)
if (a[j+1].z>a[j].z)
swap(b[j],b[j+1]);
else if(a[j+1].z==a[j].z && a[j+1].y>a[j].y)
swap(b[j],b[j+1]);
for (i=1;i<=5;i++)
cout<<b[i]<<" "<<a[b[i]].z<<endl;
return 0;
}
0 条评论
目前还没有评论...