Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位高手帮我看一下啊,提交好多次都是WA

Posted by 270987650 at 2007-08-27 17:54:13 on Problem 1007
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator