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 adamydj at 2008-04-18 22:34:36 on Problem 1007
#include <stdio.h>
main(){
	int length,number,i,j,k,max;
	char input [100][50];
	int inversions[100];
	scanf ("%d %d",&length,&number);
	for (i = 0;i < number;i++){
		inversions[i] = 0;
		scanf ("%s",input[i]);
		for (j = 0;j < length;j++){
			for (k = j+1;k < length;k++){
				if (input[i][j] > input[i][k])
					inversions[i]++;
			}
		}
	}
	max = inversions[0];
	for (i = 1;i < number;i++)
		if (max < inversions[i])
			max = inversions[i];
	for (i = 0;i <= max;i++)
		for (j = 0;j < number;j++)
			if(inversions[j] == i){
				printf ("%s\n",input[j]);
			}
}

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