Skip to content

Commit 1d21e0d

Browse files
committed
feat(codeforces): implement solve logic for p2190A
1 parent 31789b8 commit 1d21e0d

File tree

1 file changed

+22
-5
lines changed
  • src/main/java/com/lzw/solutions/codeforces/p2190A

1 file changed

+22
-5
lines changed

src/main/java/com/lzw/solutions/codeforces/p2190A/Main.java

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import java.io.IOException;
55
import java.io.InputStreamReader;
66
import java.io.PrintWriter;
7-
import java.util.HashSet;
8-
import java.util.Set;
9-
import java.util.StringTokenizer;
107

118
public class Main {
129

@@ -18,13 +15,33 @@ public class Main {
1815
out = new PrintWriter(System.out);
1916
}
2017

18+
// 100100, 100101
19+
// 000011(1,4,5,6) 000111(1,4,5)
20+
2121
void solve() throws IOException {
2222
int t = Integer.parseInt(in.readLine());
23-
while (t-->0){
23+
while (t-- > 0) {
2424
int n = Integer.parseInt(in.readLine());
2525
String s = in.readLine();
2626
assert (s.length() == n);
27-
System.out.println(s);
27+
boolean allZeros = true;
28+
int i;
29+
for (i = 0; i < n; i++) {
30+
if (s.charAt(i) == '1') {
31+
allZeros = false;
32+
}
33+
}
34+
boolean allOnes = true;
35+
for (i = 0; i < n; i++) {
36+
if (s.charAt(i) == '0') {
37+
allOnes = false;
38+
}
39+
}
40+
if (allZeros || allOnes) {
41+
out.println("Bob");
42+
} else {
43+
out.println("Alice");
44+
}
2845
}
2946
}
3047

0 commit comments

Comments
 (0)