

● 수학
● 구현
문제를 보고 간단하다는 생각이 들었다. 2의 배수와 3의 배수중 공배수의 최소값은 6이다. 그 이유는 2의 배수와 3의 배수가 같아야 되는데 6은 2와 3의 공배수이다. 그러나 2와 3은 연속된 숫자이므로 다른 숫자여야 하기때문에 무조껀 탈출이 불가하다. 그러므로 Love is open door을 출력해주면 된다.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class BOJ_17210 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
long A = Long.parseLong(br.readLine());
long B = Integer.parseInt(br.readLine());
if (A > 5) {
System.out.println("Love is open door");
} else {
for (int i = 0; i < A - 1; i++) {
if (B == 1) {
System.out.println("0");
B = 0;
} else {
System.out.println("1");
B = 1;
}
}
}
}
}
a = int(input())
b = int(input())
if a <= 5:
for i in range(a - 1):
a = int(not a)
print(a)
else:
print("Love is open door")
https://www.acmicpc.net/problem/17210