-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package S5; | ||
|
||
import java.io.*; | ||
import java.util.StringTokenizer; | ||
|
||
public class Boj_9358_순열접기게임 { | ||
public static void main(String[] args) throws IOException { | ||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | ||
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); | ||
StringBuilder sb = new StringBuilder(); | ||
|
||
int T = Integer.parseInt(br.readLine()); | ||
long[] arr = new long[100]; | ||
|
||
for (int t = 1; t <= T; t++) { | ||
int N = Integer.parseInt(br.readLine()); | ||
StringTokenizer st = new StringTokenizer(br.readLine()); | ||
|
||
for (int i = 0; i < N; i++) { | ||
arr[i] = Long.parseLong(st.nextToken()); | ||
} | ||
|
||
while (N > 2) { | ||
for (int i = 0; i < Math.ceil(N / 2.0); i++) { | ||
arr[i] += arr[N - i - 1]; | ||
} | ||
N = (int) Math.ceil(N / 2.0); | ||
} | ||
|
||
sb.append("Case #").append(t).append(": ").append(arr[0] > arr[1] ? "Alice\n" : "Bob\n"); | ||
} | ||
|
||
bw.write(sb.toString()); | ||
bw.flush(); | ||
} | ||
} |