样例过了,0蛋

P1093 [NOIP2007 普及组] 奖学金

我发个代码,你参考一下 #include<iostream> #include<algorithm> using namespace std; int n,l,m,h; struct node{ int x,y,z; }a[305]; bool cmp(node a,node b){ if(a.x!=b.x){ return a.x>b.x; } else if(a.y!=b.y){ return a.y>b.y; } else{ return a.z<b.z; } } int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>l>>m>>h; a[i].x=l+m+h; a[i].y=l; a[i].z=i+1; } sort(a,a+n,cmp); for(int i=0;i<5;i++) cout<<a[i].z<<" "<<a[i].x<<endl; return 0; }
by 青无常 @ 2018-04-02 22:26:25


@[巫神搞比利](/space/show?uid=80746)
by 青无常 @ 2018-04-02 22:27:08


@[巫神搞比利](/space/show?uid=80746) 你是真的蒻
by Kiel @ 2018-04-02 22:54:48


@[something](/space/show?uid=84025) 我还是小学生
by 巫神搞比利 @ 2018-04-03 12:40:41


|