-
Notifications
You must be signed in to change notification settings - Fork 0
/
400c.cpp
71 lines (63 loc) · 991 Bytes
/
400c.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
using namespace std;
int main() {
int N, M;
int x, y, z;
int p;
cin >> N >> M;
cin >> x >> y >> z;
cin >> p;
x %= 4;
y %= 2;
z %= 4;
int i, j, t, n, m;
while (p--) {
cin >> i >> j;
n = N; m = M;
switch (x) {
case 1:
t = j;
j = n+1-i;
i = t;
t = n;
n = m;
m = t;
break;
case 2:
i = n+1-i;
j = m+1-j;
break;
case 3:
t = i;
i = m+1-j;
j = t;
t = n;
n = m;
m = t;
break;
}
//cout << "1: " << i << " " << j << endl;
if (y == 1)
j = m+1-j;
//cout << "2: " << i << " " << j << endl;
switch (z) {
case 3:
t = j;
j = n+1-i;
i = t;
break;
case 2:
i = n+1-i;
j = m+1-j;
break;
case 1:
t = i;
i = m+1-j;
j = t;
break;
}
//cout << "3: " << i << " " << j << endl;
cout << i << ' ' << j << endl;
}
return 0;
}