Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Why WA!!!!!哪位高手帮我找找错啊#include<stdio.h> #include<string.h> #include<algorithm> using namespace std; struct st { long a; long b; }; int cmp(const st &p,const st &q) { return p.a>q.a; } int main() { int n,k,i,h; st c[50005]; scanf("%d %d",&n,&k); for(i=0;i<n;i++) scanf("%ld %ld",&c[i].a,&c[i].b); sort(c,c+n,cmp); h=0; for(i=1;i<k;i++) if(c[i].b>c[h].b) h=i; printf("%ld\n",c[h].b); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator