Python code
T = int(input())
for test_case in range(1, T + 1):
num = int(input())
winner = ""
if num % 2 == 0:
winner = "Alice"
else:
winner = "Bob"
print("#" + str(test_case) + " " + winner)
Java code
import java.util.Scanner;
// import java.io.FileInputStream;
class Main
{
public static void main(String args[]) throws Exception
{
// System.setIn(new FileInputStream("C:\\SSAFY\\intellij\\algorithm\\src\\input.txt"));
Scanner sc = new Scanner(System.in);
int T;
T = sc.nextInt();
for (int test_case = 1; test_case <= T; test_case++) {
String winner = "";
int num = sc.nextInt();
if (num % 2 == 0) {
winner = "Alice";
} else {
winner = "Bob";
}
System.out.println("#" + test_case + " " + winner);
}
}
}
난이도 측정이 잘못됐나 싶을 정도로 간단한 문제였다.
결국 조건대로라면 가장 작은 자연수(1) 로 잘라야 하기 때문에, 자르는 방법에 관계없이 자르는 횟수는 정해져있다
따라서 홀수, 짝수에 따라 답이 결정된다.
출처: https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AYJW0g-qlO8DFASv
공감하며 읽었습니다. 좋은 글 감사드립니다.