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

求助!!!为什么总是RE?自己运行就没问题

Posted by a806855059 at 2016-07-17 20:12:50 on Problem 1007
#include <stdio.h>
#include <string.h>

int main () {
	int n,m;
	scanf("%d %d", &n, &m);
	char dna[50][11];
	char temp[11];
	int measure[50];
	for (int i = 0; i < m; i++) {
		scanf("%s", dna[i]);
		int t = 0;
		for (int j = 0; j < n; j++) {
			for (int k = j; k < n; k++) {
				if (dna[i][j] - dna[i][k] > 0) {
					t++;
				} 
			}
		}
		measure[i] = t;
	}
	for (int i = 0; i < m; i++) {
		int low = i;
		for (int j = i; j < m; j++) {
			if (measure[j] < measure[low]) {
				low = j;
			}
		}
		strcpy(temp, dna[low]);
		strcpy(dna[low], dna[i]);
		strcpy(dna[i], temp);
		int tmp = measure[i];
		measure[i] = measure[low];
		measure[low] = tmp;
	}
	for (int i = 0; i < m; i++) {
		printf("%s\n", dna[i]);
	}
	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