intmain() { int n, m; unsignedint c; while (scanf(" %d %d", &n, &m) == 2) { c = 1; if (!m) n = 0; while (n > 0) { n -= c; c += m; } puts(n ? "No Stop!!" : "Go Kevin!!"); } return0; }
You have slain an enemie. You have slain an enemie. KILLING SPREE! SHUTDOWN. You have slain an enemie. You have slain an enemie. You have been slained. You have slain an enemie. 6/2/3
intmain() { int h, m; while (scanf(" %d %d", &h, &m) == 2) { m += h * 60 + 150; h = m / 60, m = m % 60; printf("%02d:%02d\n", h < 24 ? h : h - 24, m); } return0; }
voiddfs(int y, int x) { a++; map[y][x] = 0; if (map[y][x - 1]) { dfs(y, x - 1); if (l > x - 1) l = x - 1; } if (map[y][x + 1]) { dfs(y, x + 1); if (r < x + 1) r = x + 1; } if (map[y + 1][x]) { dfs(y + 1, x); if (d < y + 1) d = y + 1; } if (map[y - 1][x]) { dfs(y - 1, x); if (u > y - 1) u = y - 1; } }
intmain() { while (scanf(" %d %d", &x, &y) == 2) { for (int i = 1; i <= y; i++) { for (int j = 1; j <= x; j++) scanf(" %d", &map[i][j]); } for (int i = 1; i <= y; i++) { for (int j = 1; j <= x; j++) { if (map[i][j]) { l = j, u = i, r = j, d = i, a = 0; map[i][j] = 0; dfs(i, j); printf("%d %d %d %d %d\n", l - 1, u - 1, r - 1, d - 1, a); } } } } return0; }
Given a set of n points in a plane with integer coordinates (xi, yi), i = 1, 2, . . . , n. Your task is to decide whether the set of points has a center of symmetry or not.
A set of points S has a center of symmetry if there exists a point s (not necessarily in S) such that for every point p in S there exists a point q in S such that p - s = s - q.
輸入
For each case, the first line contains a number n, 1 <= n <= 10000. The subsequent n
lines contain two integers, which are the x and y coordinates of the point. Every point is unique and -10000000 <= x, y <= 10000000. A line with 0 (n = 0) signifies the end of input. A figure shown below is the sample input.
8 1 10 3 6 6 8 6 2 3 -4 1 0 -2 -2 -2 4 0
輸出
For each set of input data print “yes” if the set of points has a center of symmetry and “no” otherwise.