def sol(n, r, c):
global result
if n == 2:
if r == R and c == C:
print(result)
return
result += 1
if r == R and c + 1 == C:
print(result)
return
result += 1
if r + 1 == R and c == C:
print(result)
return
result += 1
if r + 1 == R and c + 1 == C:
print(result)
return
result += 1
return
sol(n / 2, r, c)
sol(n / 2, r, c + n / 2)
sol(n / 2, r + n / 2, c)
sol(n / 2, r + n / 2, c + n / 2)
result = 0
N, R, C = map(int, input().split(' '))
sol(2 ** N, 0, 0)
'Programming > Algorithm' 카테고리의 다른 글
[Python] 백준 2747번 : 피보나치 수 (0) | 2020.11.11 |
---|---|
[Python] 백준 10989번 : 수 정렬하기 3 (0) | 2020.11.11 |
[Python] 백준 11650번 : 좌표 정렬하기 (0) | 2020.11.11 |
[Python] 백준 10814번 : 나이순 정렬 (0) | 2020.11.11 |
[Python] 백준 1427번 : 소트인사이드 (0) | 2020.11.11 |