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 |
What problem!!!!#include<stdio.h> #include<math.h> void main() { int n,i,j,k,a[50000][2],min,p,num=0,temp; scanf("%d",&n); for(;;) { num=0; if(n==0) break; for(i=0;i<n;i++) { for(j=0;j<2;j++) { scanf("%d",&a[i][j]); } } for(i=0;i<n;i++) { k=i+1; min=i; for(j=k;j<n+1;j++) { if(a[j][0]<a[min][0]) min=j; } temp=a[j][0]; a[j][0]=a[min][0]; a[min][0]=temp; } for(i=0;i<n;i++) { p=n-1; if(a[i][0]+a[i][1]>a[p][0]+a[p][1]) { printf("0\n"); break; } if(a[i][0]+a[i][1]==a[p][0]+a[p][1]) num++; } printf("%d\n",num); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator