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

请大神指教,为什么1007题在自己电脑上运行是对的,提交就是wrong answer。看一下我的代码有什么问题。谢谢

Posted by 0706_1227 at 2014-09-13 18:52:58
#include <stdio.h>

int main()
{
	char a[100][50];
	int b[100];
	int i,j,k,n,m,min;

	scanf("%d%d",&n,&m);
	if (m > 100 || m <= 0)return 0;
	if (n > 50 || n <=0)return 0;
	for (i = 0; i < m; i++)
		scanf("%s",a[i]);

	for (i = 0; i < m; i++){
		b[i] = 0;
		for (j = 0; j < n; j++){
			for (k = j+1; a[i][k] != '\0'; k++)
				if (a[i][j] > a[i][k])b[i]++;
		}
	}	
	for (i = 0; i < m; i++){
        min = i;
		for (j = 0; j < m; j++)
			if (b[j] < b[min])min = j;
				printf("%s\n",a[min]);
				b[min]=10000;
	}

	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