-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ10464.java
More file actions
38 lines (30 loc) · 966 Bytes
/
Copy pathJ10464.java
File metadata and controls
38 lines (30 loc) · 966 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
32
33
34
35
36
37
38
package TIL;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class J10464 {
public static void main(String[] args) throws IOException {
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(buffer.readLine());
int t = 0 ;
while(T > t){
int ans = 1;
String[] input = buffer.readLine().split(" ");
int s = Integer.parseInt(input[0]);
int f = Integer.parseInt(input[1]);
int sum = 1;
for(int i = 1; i < s; i++){
sum^=i;
}
for(int i = 1; i <= f; i++){
ans^=i;
}
ans = ans^sum;
t++;
System.out.println(ans);
}
}
public static void print(int num){
System.out.println(String.format("%s", Integer.toBinaryString(num)));
}
}