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

一直RunTime,求大神帮吗解释下

Posted by 2875594834 at 2015-10-16 17:40:04 on Problem 1007
#include<stdio.h>
#include<string.h>
#include <stdlib.h>
#define Max 11
char str[Max][Max];
char R[Max];
char Q[Max];
int T[Max];
int Sort(char p[][Max],int n,int i){
	int o,j,q=0;
	for(o=0;o<n;o++){
	//	memset(R,0,sizeof(R));
		for(j=o;j<n-1;j++){
			//R[j]=P[i][j+1];
			if(p[i][o]>p[i][j+1]){
				q++;
			}
		}
		
	}
	
	return q;
}
int Sort2(int e){
	int i,min,j=0;
	min = T[0];
	for(i=1;i<e;i++){
		if(min>T[i]){
			min=T[i];
			j=i;
		}
	}
	T[j]=100;
	return j;
}
int main(){
	int n,m,i,j=0,k;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%s",str[i]);
	}
	for(;j<m;j++){
		T[j]=Sort(str,n,j);
	}
	for(i=0;i<m;i++){
		k=Sort2(j);
		puts(str[k]);
	}
	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