| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
WA.解释下。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator