Arm Coordination

Question

Solution

Idea

This is a give-away question also. The easiest way is to get the four coordinates as follows:

  1. (x-r, y+r)

  2. (x-r, y-r)

  3. (x+r, y-r)

  4. (x+r,y+r)

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/armcoordination/armcoordination.c
#include <stdio.h>

int main()
{
  long x, y, r;

  scanf("%ld %ld", &x, &y);
  scanf("\n%ld", &r);

  printf("%ld %ld\n", x-r, y+r);
  printf("%ld %ld\n", x-r, y-r);
  printf("%ld %ld\n", x+r, y-r);
  printf("%ld %ld\n", x+r, y+r);
}

Last updated