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 |
为啥用的哈希过不了?求大神解答!(代码附上)//别告诉我数组开小了?! #include<iostream> #include<stdio.h> #include<string.h> #define SIZE 10000000 using namespace std; bool Hash[SIZE]; int main() { long long n; while(cin>>n) { long long sol=0; memset(Hash,0,sizeof(Hash)); while(n--) { long long a; scanf("%lld",&a); if(Hash[a])continue; else Hash[a]=1; sol++; } cout<<sol<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator