求助!!

P1085 [NOIP2004 普及组] 不高兴的津津

希望更丰富的展现?使用Markdown
by _____hzf_____ @ 2018-12-28 16:39:39


以后红题就别来问了,自己看题解去 ```cpp #include<iostream> using namespace std; int main() { int i,j,k,m; int time[7][2]; for(i=0;i<2;i++) for(j=0;j<7;j++) cin>>time[i][j]; for(k=6;k>=0;k--) { if(time[k][0]+time[k][1]>8) { m=k; if(m==0) m=7; } } cout<<m; return 0; } ```
by JAMERES86 @ 2018-12-28 16:47:21


```cpp #include<iostream> #include<algorithm> using namespace std; struct node{ int a,b; }; node z[23333]; bool cmp(node a,node b){ if(a.a>b.a){ return 1; }else if(a.a<b.a){ return 0; }else{ if(a.b<b.b){ return 1; }else{ return 0; } } return 0; } int main(){ for(int i=0;i<7;i++){ int x,y; cin>>x>>y; z[i].a=x+y; z[i].b=i+1; } sort(z,z+7,cmp); cout<<z[0].b<<endl; return 0; } ```
by JAMERES86 @ 2018-12-28 16:48:26


@[JAMERES86](/space/show?uid=95875) okok 谢谢大佬!!
by cwxnba @ 2018-12-28 16:51:46


|