Drind @ 2020-02-03 10:18:54
#include<iostream>
using namespace std;
int main()
{
int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>y[i]>>s[i]>>e[i];
z[i]=y[i]+s[i]+e[i];
}
for(j=1;j<=5;j++)
{
max[1][j]=z[1];
max[2][j]=1;
max[3][j]=y[1];
for(i=2;i<=n;i++)
{
if (z[i]==max[1][j])
{
if (max[3][j]<y[i])
{
max[1][j]=z[i];
max[2][j]=i;
max[3][j]=y[i];
}
if (max[3][j]==y[i])
{
if (max[2][j]>i)
{
max[1][j]=z[i];
max[2][j]=i;
max[3][j]=y[i];
}
}
}
if (z[i]>max[1][j])
{
max[1][j]=z[i];
max[2][j]=i;
max[3][j]=y[i];
}
}
cout<<max[2][j]<<" "<<max[1][j]<<endl;
z[max[2][j]]=0;
}
return 0;
}
by Drind @ 2020-02-03 10:33:42
emmmm我就不会啊
by Resonaa @ 2020-02-03 10:35:13
@HShongshi 您把变量放在主函数外面试试。
by Bbaka @ 2020-02-03 10:41:11
@HShongshi max数组定义有问题,越界了
by Bbaka @ 2020-02-03 10:46:03
@HShongshi 应该是max[4][6]
by Drind @ 2020-02-03 14:32:52
@IQZ_ 可是我怎么下载数据自己比对就是对的?难道洛谷有Bug?