Skip to content

Commit ef42d36

Browse files
authored
Create Xor Compare(Partial).java
1 parent 9e8e817 commit ef42d36

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import java.util.*;
2+
import java.lang.*;
3+
import java.io.*;
4+
5+
class Codechef
6+
{
7+
static class FastReader
8+
{
9+
BufferedReader br;
10+
StringTokenizer st;
11+
12+
public FastReader()
13+
{
14+
br = new BufferedReader(new
15+
InputStreamReader(System.in));
16+
}
17+
18+
String next()
19+
{
20+
while (st == null || !st.hasMoreElements())
21+
{
22+
try
23+
{
24+
st = new StringTokenizer(br.readLine());
25+
}
26+
catch (IOException e)
27+
{
28+
e.printStackTrace();
29+
}
30+
}
31+
return st.nextToken();
32+
}
33+
34+
int nextInt()
35+
{
36+
return Integer.parseInt(next());
37+
}
38+
39+
40+
long nextLong()
41+
{
42+
return Long.parseLong(next());
43+
}
44+
45+
double nextDouble()
46+
{
47+
return Double.parseDouble(next());
48+
}
49+
50+
String nextLine()
51+
{
52+
String str = "";
53+
try
54+
{
55+
str = br.readLine();
56+
}
57+
catch (IOException e)
58+
{
59+
e.printStackTrace();
60+
}
61+
return str;
62+
}
63+
}
64+
public static void main(String[] args) throws java.lang.Exception{
65+
FastReader sc=new FastReader();
66+
int t=sc.nextInt();
67+
while(t-->0) {
68+
long x=sc.nextLong();
69+
long y=sc.nextLong();
70+
long n=sc.nextLong();
71+
long res=0;
72+
for(long i=n;i>=0;i--) {
73+
if((x^i)<(y^i)) {
74+
res++;
75+
}
76+
}
77+
System.out.println(res);
78+
}
79+
}
80+
}

0 commit comments

Comments
 (0)