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 |
实在找不出错在哪了 好郁闷!!#include <iostream.h> #include <stdlib.h> int cmp ( const void *,const void *); void main() { while(1) { int time; cin>>time; if(time==0) break; long a[50001],b[50001]; for(int i=0;i<time;i++) cin>>a[i]>>b[i]; int temp1=0; int temp2=0; int d1=1; int d2=1; for(i=1;i<time;i++) { //if( (a[i]==a[temp1])&&(b[i]==b[temp1]) ) //d1++; //if( (a[i]==a[temp2])&&(b[i]==b[temp2]) ) //d2++; if( (a[i]==a[temp1])&&(b[i]==b[temp1])|| (a[i]==a[temp2])&&(b[i]==b[temp2]) ); else if( (a[i]>=a[temp1])&&(b[i]>=b[temp2]) ) { temp1=i; temp2=i; d1=1; d2=1; } if( (a[i]>=a[temp1])&&(b[i]>=b[temp2]) ); else if((a[i]>a[temp1])) { d1=1; temp1=i; } if((b[i]>b[temp2])) { d2=1; temp2=i; } } if(temp1==temp2) cout<<d1<<endl; else cout<<d1+d2<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator