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

wa,不知道为什么,各位帮忙看看啊!

Posted by shangmin at 2005-09-11 09:05:30 on Problem 2535
#include<stdio.h>
int main()
{
	int n,m,i,j,a[101],min,simple[101],number,half,sum,max;
	char tag[101][103];
    scanf("%d%d",&n,&m);

	for(i=1;i<=n;i++)
	{
		min=1001;
		max=-1;
		for(j=1;j<=m;j++)
		{
			scanf("%d",&a[j]);
			if(a[j]<min)
				min=a[j];
			if(a[j]>max)
				max=a[j];
		}
		for(j=1;j<=m;j++)
		{		
			if(a[j]==max)
				tag[i][j]='-';
			else
				if(a[j]==min)
				   tag[i][j]='Y';
					else
						tag[i][j]='N';
		}
	}
	number=0;
	half=m/2;
	for(i=1;i<=m;i++)
	{
		sum=0;
		for(j=1;j<=n;j++)
		{
			if(tag[j][i]=='Y')
                 sum++;
			else
				if(tag[j][i]=='-')
				{
					sum=0;
                    break;
				}
		}
			if(sum>half)
			{
				number++;
				simple[number]=i;
			}
	}
	if(number==0)
		printf("0\n");
	else
	{
		for(i=1;i<number;i++)
			printf("%d ",simple[i]);
		printf("%d\n",simple[number]);
	}
	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