A、坐标变换(其一)
样例输入
3 2
10 10
0 0
10 -20
1 -1
0 0
样例输出
21 -11
20 -10
题解
按照题目,一个循环即可
#include <bits/stdc++.h>
using namespace std;
#define N 200010
#define ll long long
template <class T>
inline void read(T& a){
T x = 0, s = 1;
char c = getchar();
while(!isdigit(c)){ if(c == '-') s = -1; c = getchar(); }
while(isdigit(c)){ x = x * 10 + (c ^ '0'); c = getchar(); }
a = x * s;
return ;
}
int n, m;
int dx[N], dy[N];
int main(){
cin >> m >> n;
for(int i = 1; i <= m; i++)
read(dx[i]), read(dy[i]);
for(int i = 1; i <= n; i++){
int x, y;
cin >> x >> y;
for(int j = 1; j <= m; j++){
x += dx[j];
y += dy[j];
}
cout << x << " " << y << endl;
}
return 0;
}
B、坐标变换(其二)
样例输入
10 5
2 0.59
2 4.956
1 0.997
1 1.364
1 1.242
1 0.82
2 2.824
1 0.716
2 0.178
2 4.094
1 6 -953188 -946637
1 9 969538 848081
4 7 -114758 522223
1 9 -535079 601597
8 8 159430 -511187
样例输出
-1858706.758 -83259.993
-1261428.46 201113.678
-75099.123 -738950.159
-119179.897 -789457.532
114151.88 -366009.892