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 |
为什么hash超时 帮忙看看啊,大哥大姐们,发现问题的发我邮箱,谢谢了~~~#pragma warning(disable:4786) #include<stdio.h> #include <map> using namespace std; typedef map<int,int> intmap; typedef intmap::value_type maptype; int main() {int i,j,k,l; long a[300]; int num; int num1; int flag=0; intmap temp; scanf("%d",&num); for(i=0;i<num;i++) {scanf("%d",&num1); for(j=0;j<num1;j++) scanf("%d",&a[j]); for(k=num1;;k++) { temp.clear(); for(l=0;l<num1;l++) { temp[a[l]%k]++; if(temp[a[l]%k]>1)break; } if(l==num1){printf("%d\n",k);break;} } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator