(BOJ/백준) 4892 – 숫자 맞추기 게임 (Python)

문제가 있는 링크

문제를 해결하다

입력 값을 받은 후 지정된 규칙에 따라 출력합니다.
n1이 홀수인지 짝수인지에 따라 출력이 달라집니다.

올바른 응답 코드

cnt = 1
while True :
    n = int(input())
    if n == 0 : break
    if n * 3 % 2 == 0 : print("{:d}. even {:d}".format(cnt, (3 * n // 2) * 3 // 9))
    else : print("{:d}. odd {:d}".format(cnt, ((3 * n + 1) // 2) * 3 // 9))
    cnt += 1