forked from Red-0111/Anything-Repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
31 lines (30 loc) · 732 Bytes
/
Test.java
File metadata and controls
31 lines (30 loc) · 732 Bytes
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
import java.io.*;
import java.util.*;
class hello
{
public static void main(String[] args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//int a[]=Arrays.stream(br.readLine().split("[ ]+")).mapToInt(Integer::parseInt).toArray();
//System.out.println(Arrays.toString(a));
int n=Integer.parseInt(br.readLine());
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=Integer.parseInt(br.readLine());
}
int min=Integer.MAX_VALUE;
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
int ans=(a[i] & a[j]) ^ (a[i] | a[j]);
if(ans<min)
{
min=ans;
}
}
}
System.out.println(min);
}
}