h.c 407 B

123456789101112131415161718
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int x, y, x1, y1;
  6. double PI = 4.0 * atan(1.0);
  7. while(~scanf("%d%d%d%d", &x, &y, &x1, &y1))
  8. {
  9. x1 -= x,y1 -= y;
  10. double R = asin(y1 / sqrt((x1 * x1) + (y1 * y1)));
  11. if (x1 < 0) R = -R - PI;
  12. double c = R * 360 / 2 / PI;
  13. printf("%d\n", (110 - (int) c) % 360 / 40 + 1);
  14. }
  15. return 0;
  16. }