-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecnuoj1043.cpp
49 lines (49 loc) · 938 Bytes
/
ecnuoj1043.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
using namespace std;
int minm(vector<int> v)
{
sort(v.begin(),v.end());
int maxv = v[v.size()-1];
int signal = 1;
int result=0;
for(int i=0;i<maxv;i++)
{
set<int> modv;
int setsize=0;
signal = 1;
for(int j=0;j<v.size();j++)
{
modv.insert(v[j]%i);
if(setsize==modv.size())
{
break;
signal = 0;
}
}
if(signal==1)
{
result = i;
break;
}
}
return result;
}
int main()
{
int t=0;
while (~scanf("%d",&t))
{
vector<int> v;
for(int i=0;i<t;i++)
{
int k=0;
scanf("%d",&k);
v.push_back(k);
}
cout<<minm(v)<<endl;
}
return 0;
}