X轴与Y轴独立,且当n为奇数时,循环节为2*n。
#include <bits/stdc++.h>
#define aint(x) x.begin(), x.end()
using namespace std;
typedef long long LL;
const int maxn = 111;
const int pi = acos(-1.0);
struct Point {
int x, y;
Point(int x = 0, int y = 0):x(x),y(y) {};
void getin() {
scanf("%d%d", &x, &y);
}
};
Point Getpair(Point a, Point b) {
return {2*b.x - a.x, 2*b.y-a.y};
}
vector<int> X, Y;
int main() {
Point s;
vector<Point> V;
int n;
long long m;
scanf("%d%lld", &n, &m);s.getin();
for(int i = 1; i <= n; i++) {
Point tmp;
tmp.getin();
V.push_back(tmp);
}
for(int i = 1; i <= 2; i++)
for(auto it:V) {
s = Getpair(s, it);
X.push_back(s.x);
Y.push_back(s.y);
}
printf("%d %d\n", X[(m-1)%(2*n)], Y[(m-1)%(2*n)]);
return 0;
}