코딩테스트/백준
[실3] 10158 - 개미
ShovelingLife
2023. 10. 20. 16:49
#include <iostream>
#pragma region 입출력 속도향상
#define FAST_IO() \
{\
ios::sync_with_stdio(false);\
cin.tie(NULL); \
cout.tie(NULL); \
}\
#pragma endregion
using namespace std;
#define x first
#define y second
int main()
{
FAST_IO();
int w, h, p, q, t;
cin >> w >> h >> p >> q >> t;
p += t;
q += t;
p %= (2 * w);
q %= (2 * h);
if (p > w)
p = 2 * w - p;
if (q > h)
q = 2 * h - q;
cout << p << ' ' << q;
return 0;
}