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 happy__ting at 2010-06-04 13:26:19 on Problem 3320
#include<cstdio>
#include<iostream>
using namespace std;
int a[1000005];
int main()
{
	int j,start,i,q,count=0,flag;
	scanf("%d",&q);
	scanf("%d",&start);
	a[count++]=start;
	for(i=1;i<q;i++)
	{
		flag=1;
		scanf("%d",&start);
		for(j=0;j<count;j++)
			if(start==a[j])
			{
				flag=0;
				break;
			}
		if(flag)
			a[count++]=start;
	}
	printf("%d\n",count);
	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