Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
请高手帮忙看看哪有问题,总是提交不了!谢谢了!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator