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?KANKAN...

Posted by 36042819900919291x at 2009-12-17 12:52:21 on Problem 1007
#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:
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