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> void main() { int x[51],y[51],xx[51],yy[51],i=0,ii=0,a,b,m,n,f[51],max,p,c,d; for(m=0;m<50;m++)f[m]=m; m=0; double t[51],tt[51]; cin>>c>>d; while(cin>>a>>b) { if( a-c<0 && b-d<0 ) { xx[ii]=a; yy[ii]=b; tt[ii]=double(b-d)/(a-c); ii++; } else { x[i]=a; y[i]=b; t[i]=double(b-d)/(a-c); i++; } } for(m=0;m<ii;m++) { max=m; for(n=m+1;n<=ii;n++) { if(tt[f[n]]>tt[f[max]])max=n; } p=f[max]; f[max]=f[m]; f[m]=p; } cout<<'('<<c<<','<<d<<")\n"; for(m=ii-1;m>=0;m--)cout<<'('<<xx[f[m]]<<','<<yy[f[m]]<<')'<<endl; for(m=0;m<50;m++)f[m]=m; for(m=0;m<i;m++) { max=m; for(n=m+1;n<=i;n++) { if(t[f[n]]>t[f[max]])max=n; } p=f[max]; f[max]=f[m]; f[m]=p; } for(m=i-1;m>=0;m--)cout<<'('<<x[f[m]]<<','<<y[f[m]]<<')'<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator