江湖救急,谁能帮我改一下,谢谢!!!

P1066 [NOIP2006 提高组] 2^k进制数

```cpp #include<bits/stdc++.h> using namespace std; struct fs { int xh; float num; }; fs a[5001]; int cmp(const fs &a,const fs &b) { return a.num>b.num; } int main() { int i,x,m,n,fx; cin>>n>>m; for(i=1;i<=n;i++) cin>>a[i].xh>>a[i].num; sort(a,a+n+1,cmp); x=m*1.5; while(a[x].num==a[x+1].num) { x++; fx=a[x+1].num; } fx=a[x].num; cout<<fx<<" "<<x<<endl; for(i=1;i<=x;i++) cout<<a[i].xh<<" "<<a[i].num<<endl; return 0; } ```
by lckcode @ 2018-07-24 18:22:00


已經幫你改了。 所有跟a[x].num一樣的都能夠,要用while loop
by lckcode @ 2018-07-24 18:22:57


@[lckcode](/space/show?uid=73224) 谢谢
by 最帅滴打劫君 @ 2018-08-24 10:33:15


|