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

2092WA...哪位大侠帮看看程序~谢谢~

Posted by Zhouworld16 at 2009-02-09 23:45:46
数据过了,可是一提交就WA...

#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int N=0,M=0,h=-1;
	int a[10005];
	int b[10005];
	int c[250000];

	for(int i=0;i<250000;i++)
	{
		c[i]=-1;
	}
	
	while(cin>>N>>M)
	{
		if(N!=0&&M!=0)
		{
			for(int i=0;i<10005;i++)
	        {
		      a[i]=0;
		      b[i]=0;
	        }
			for(int i=0;i<N;i++)
			{
				for(int j=0;j<M;j++)
				{
					int x;
					cin>>x;
					a[x]++;
					b[x]=a[x];
				}
			}
			int *p=b;
			sort(p,p+10000);
			for(int i=0;i<10005;i++)
			{
				if(p[9998]==a[i])
				{
					c[++h]=i;

				}
			}
			c[++h]=0;
		}
		else 
		{
			for(int i=0;i<250000;i++)
			{
				if(c[i]==0)cout<<endl;
				else if(c[i]!=-1)
				{   if(c[i+1]!=0)
					cout<<c[i]<<ends;
				   else cout<<c[i];
				}
				     
			}

			break;

		}
	}

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