practivceAlgorithm/백준
[백준][Python] 10158 개미
findTheValue
2021. 8. 28. 23:43
좌표평면에서 기준선 0, w,h 축을 기준으로 범위 안에 들어올때까지 대칭시키는 방법.
import sys
input = sys.stdin.readline
w, h = map(int, input().split())
p, q = map(int, input().split())
t = int(input())
init_x = p + t
init_y = q + t
if not (init_x//w)&1:
x = (-2*w*((init_x//w)//2) + init_x)
else:
x = 2*w - (-2*w*((init_x//w)//2) + init_x)
if not (init_y//h)&1:
y = (-2*h*((init_y//h)//2) + init_y)
else:
y = 2*h - (-2*h*((init_y//h)//2) + init_y)
print(x,y)