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

麻烦帮我看看错在哪啊????

Posted by scnu20072205626 at 2008-09-17 21:21:25 on Problem 1007
#include<iostream>
using namespace std;
int main(){
    int n,m,c;
    cin>>n>>m;
   char a[100][50];
   int b[100];
   for(int i=0;i<m;i++){
           b[i]=0;
       for(int j=0;j<n;j++){
            cin>>a[j][i];      
               }
               for(int k=0;k<n-1;k++){
                       for(int g=k+1;g<n;g++){
                       if(a[k][i]>a[g][i]) b[i]++;
                       }
                       }
           }
           cout<<endl;
           for(int l=0;l<m-1;l++){
                   for(int o=m-1;o>l;o--){
                           if(b[l]>b[o]){
                                         for(int q=0;q<n;q++){
                           c=a[q][l];a[q][l]=a[q][o];a[q][o]=c;
                            }             
                                         }
                           }
                   }
       for(int i=0;i<m;i++){
       for(int j=0;j<n;j++){
            cout<<a[j][i];
            }
            cout<<endl;
            }
        
    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