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#include "iostream" using namespace std; int main() { int i,N; cin>>i>>N; char a[100][50]; int len; int b[100],c[100]; int m,n; for(m=0;m<N;m++) { len=0; for( n=0;n<i;n++) cin>>a[m][n]; for(int k=0;k<i;k++) { for(int j=k+1;j<i;j++) { if(a[m][k]>a[m][j]) len++; } } b[m]=len; c[m]=len; } for(m=0;m<N;m++) { for(int j=0;j<N-m;j++) { int t; if(b[j]<b[j-1]) { t=b[j-1]; b[j-1]=b[j]; b[j]=t; } } } for(m=0;m<N;m++) { for(int r=0;r<N;r++) if(b[m]==c[r]) { for(int j=0;j<i;j++) cout<<a[r][j]; cout<<endl; } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator