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:如此的题目怎么会WA??

Posted by tear at 2003-08-28 23:32:53 on Problem 1007
In Reply To:如此的题目怎么会WA?? Posted by:tear at 2003-08-28 23:28:26
我在ZJU过了的
FT
> #include <stdio.h>
> #include <stdlib.h>
> char map[100][51];
> int sign[100];
> int value[100];
> int n, m;
> int cmp(const void *a, const void *b)
> {
> 	return value[*(int *)a] > value[*(int *)b];
> }
> int main()
> {
> 	int i, j, k;
> 		scanf("%d %d", &m, &n);
> 		for(i = 0 ; i < n; i++)
> 		{
> 			sign[i] = i;
> 			scanf("%s", map[i]);
> 			value[i] = 0;
> 			for(j = 0 ; j < m - 1; j++)
> 			{
> 				for(k = j + 1; k < m; k++)
> 				{
> 					if(map[i][j] > map[i][k])
> 						value[i]++;
> 				}
> 			}			
> 		}
> 		qsort(sign, n, sizeof(sign[0]), cmp);
> 		for(i = 0 ; i < n ; i++)
> 		{
> 			printf("%s\n", map[sign[i]]);
> 		}
> 
> 	return 1;
> }

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