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 pantherybj at 2004-12-06 13:30:02 on Problem 1007
#include<iostream.h>
#include<string.h>
#include<stdio.h>
void main()
{  
	int n,m;
	cin>>n>>m;
	char  s[100][50];
    int temp[50];
 	char stemp[50];
	
	for(int i=0;i<m;i++){
		cin>>s[i];
		temp[i]=0;
		for(int j=0;j<n;j++)
			for(int k=j+1;k<n;k++){
				if(s[i][j]>s[i][k]) ++temp[i];
			}
	}
 
	int m1=m-1;
	int t;
	for(i=0;i<m-1;i++){
		for(int j=0;j<m1;j++){
			if(temp[j]>temp[j+1]){ t=temp[j+1];temp[j+1]=temp[j];temp[j]=t;strcpy(stemp,s[j]);strcpy(s[j],s[j+1]);strcpy(s[j+1],stemp);}
		}
		--m1;
	}
	for(i=0;i<m;i++)	
     	cout<<s[i]<<"\n";
 
    
 }

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