坐标变换(其一)
前缀和
import java.util.*;
import java.io.*;
public class Main {
static final int N = 100010;
static ArrayList<int[]> list = new ArrayList<>();
static int n, m;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
String[] str = br.readLine().split(" ");
n = Integer.parseInt(str[0]); m = Integer.parseInt(str[1]);
for (int i = 1; i <= n; i++) {
str = br.readLine().split(" ");
int a = Integer.parseInt(str[0]), b = Integer.parseInt(str[1]);
list.add(new int[]{a, b});
}
int dx = 0, dy = 0;
for (int[] item : list) {
dx += item[0];
dy += item[1];
}
for (int i = 1; i <= m; i++) {
str = br.readLine().split(" ");
int x = Integer.parseInt(str[0]), y = Integer.parseInt(str[1]);
out.println((x + dx) + " " + (y + dy));
}
out.flush();
}
}