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

我在vc上运行的时候明明答案是正确的,但传到这边就说答案出错,请高人指点

Posted by babyheart at 2009-10-19 17:55:56 on Problem 1007
#include<stdio.h>

char a[101][51];
int b[101][51],i,j;

int main () {
	int k,l,m,n;
	scanf("%d %d",&i,&j);
	getchar();
	for(l=1;l<=j;l++) {
		for(k=1;k<=i;k++) {
			a[l][k]=getchar();
			for(m=1;m<k;m++) {
				if(a[l][m]>a[l][k]) {
					b[l][m]++;
				};
			};
		};
		getchar();
	};
	for(l=1;l<=j;l++) {
		for(k=1;k<=i;k++) {
			b[l][0]+=b[l][k];
		};
	};
	b[0][1]=1;
	for(l=2;l<=j;l++) {
		b[0][l]=l;
		for(k=l-1;k>=0;k--) {
			n=b[0][k];
			if(b[n][0]>b[l][0]) {}
			else {
				k++;
				for(n=l;n>=k+1;n--) {
					b[0][n]=b[0][n-1];
				};
				b[0][k]=l;
				break;
			};
		};
	};
	for(l=1;l<=j;l++) {
		m=b[0][l];
		for(k=1;k<=i;k++) {
			putchar(a[m][k]);
		};
		printf("\n");
	};
	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