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

看来我一时是死不了了

Posted by 20054959 at 2007-01-15 22:33:06 on Problem 1007
In Reply To:多栽点跟头,然后才会知道如何写程序 Posted by:number at 2007-01-15 16:54:36
#include<stdio.h>
main()
{char str[100][50];
int n,m,i,j,s[100]={0},p[100]={0},q=0,t,k;
scanf("%d%d",&n,&m);
if(m>0&&m<=100&&n>0&&n<=50)
{
for(i=0;i<m;i++)
	scanf("%s",str[i]);	
for(i=0;i<m;i++)	
	for(j=0;j<n-1;j++)
		for(k=j+1;k<n;k++)
			if(str[i][j]>str[i][k]) 
				p[i]++;
for(i=0;i<m;i++)
	{k=10000;
	for(j=0;j<m;j++)
		{if(k>p[j]&&s[j]==0) 
			{t=j;k=p[j];
			 continue;}
		if(k==p[j]&&s[t]==0&&q==0) 
			
			{q=1;
			continue;
			}
		}
	printf("%s\n",str[t]);
	s[t]=1;
	q=0;
	}       
}
}
大哥说的是把i换成j吧  可还是不行啊
上面是我提交的WA的程序.再帮忙看一下,速求一死!!!!!!!!!

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