标签:
1 #include<iostream> 2 #include<stdio.h> 3 #include<set> 4 #define MAXN 305 5 using namespace std; 6 int a[MAXN]; 7 int mod[MAXN]; 8 set<int> coll; 9 set<int>::iterator pos; 10 int main() 11 { 12 ///freopen("acm.acm","r",stdin); 13 int test; 14 int g; 15 int i; 16 bool boo; 17 int j; 18 int k; 19 int modo; 20 scanf("%d",&test); 21 while(test --) 22 { 23 scanf("%d",&g); 24 for(i = 0; i < g; ++ i) 25 { 26 scanf("%d",&a[i]); 27 } 28 for(j = g ;; ++ j) 29 { 30 boo = false; 31 for(i = 0; i < g; ++ i) 32 { 33 mod[i] = a[i]%j; 34 } 35 for(i = 0; i < g; ++ i) 36 { 37 for(k = i + 1; k < g; ++ k) 38 { 39 if(mod[i] == mod[k]) 40 //boo = true; 41 break; 42 } 43 if(k < g) 44 break; 45 } 46 if(i == g) 47 { 48 printf("%d\n",j); 49 break; 50 } 51 } 52 } 53 }
标签:
原文地址:http://www.cnblogs.com/gavinsp/p/4568675.html