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 |
自己运行很正确,为什么还是WA?KANKAN...#include<iostream> using namespace std; int main() {int M,N,temp=0; int i,j,k,h; int mea=0,measure=0,aim; cin >> M >> N; char* b[100]; int c[100]; char ch; for( h=0;h<N;h++) { char * a=new char[M+1]; for( i=0;i<M;i++) cin>> a[i]; a[i]='\0'; measure=0; for(j=0;j<M;j++) { mea=0; for( k=j+1;k<M;k++) if(a[j]>a[k]) mea++; measure+=mea; } c[h]=measure; b[h]=a; } for(i=0;i<N;i++) { for(k=0;k<N;k++) if(c[k]>temp) { aim = k; break;} for(j=0;j<N;j++) if( c[j]<c[aim]&& c[j]>temp ) aim=j; cout << b[aim] << endl; temp=c[aim]; } system ("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator