반응형
SMALL
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 | #include <stdio.h> int main(void) { int x, y; int w, h; int mx = 1; int my = 1; scanf("%d %d", &w, &h); scanf("%d %d", &x, &y); printf("%d %d\n", x, y); for (int i = 0; i < 8; i++) { if ((x + mx) > w || (x + mx) < 0) { mx = -mx; } x = x + mx; if ((y + my) > h || (y + my) < 0) { my = -my; } y = y + my; printf("%d %d\n", x, y); } return 0; } |
반응형
LIST