Skip to content

Commit 23e0495

Browse files
authored
[20250317] BOJ / G1 / 판드랄추 / 권혁준
1 parent 5474f31 commit 23e0495

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
```java
2+
3+
import java.util.*;
4+
import java.io.*;
5+
6+
class Main {
7+
8+
// IO field
9+
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
10+
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
11+
static StringTokenizer st = new StringTokenizer("");
12+
13+
static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());}
14+
static int nextInt() throws Exception {
15+
if(!st.hasMoreTokens()) nextLine();
16+
return Integer.parseInt(st.nextToken());
17+
}
18+
static long nextLong() throws Exception {
19+
if(!st.hasMoreTokens()) nextLine();
20+
return Long.parseLong(st.nextToken());
21+
}
22+
static void bwEnd() throws Exception {bw.flush();bw.close();}
23+
24+
// Additional field
25+
26+
static int a, b;
27+
28+
public static void main(String[] args) throws Exception {
29+
30+
for(int T=nextInt();T-->0;) {
31+
32+
ready();
33+
solve();
34+
}
35+
36+
bwEnd();
37+
38+
}
39+
40+
static void ready() throws Exception{
41+
42+
a = nextInt();
43+
b = nextInt();
44+
45+
46+
}
47+
48+
static void solve() throws Exception{
49+
50+
51+
char g = 'A';
52+
if(a<b) {
53+
int t = a;
54+
a = b;
55+
b = t;
56+
g = 'B';
57+
}
58+
if((a+b)%2 == 1) bw.write("-1\n");
59+
else {
60+
int half = (a-b)/2;
61+
if(half > 0 && (half&a) == half) bw.write("1\n" + g + " " + half + "\n");
62+
else bw.write("2\n" + g + " " + half + "\n" + g + " " + half + "\n");
63+
}
64+
65+
}
66+
67+
}
68+
69+
```

0 commit comments

Comments
 (0)