Advertisement
Soupborsh

dumb_geometry1_WIP

Apr 11th, 2025
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. #define ULL unsigned long long
  4. #define LL long long
  5. #define uint unsigned int
  6. #define uchar unsigned char
  7.  
  8. inline void thing(void) {
  9.   LL x1, y1, x2, y2, x3, y3;
  10.   scanf("%lld %lld %lld %lld %lld %lld", &x1, &y1, &x2, &y2, &x3, &y3);
  11.  
  12.   bool above, direction; // direction == true if right is above
  13.   LL half1 = ((x3 - x1) * (y2 - y1)), half2 = ((y3 - y1) * (x2 - x1));
  14.  
  15.   if (half1 == half2) {
  16.     printf("TOUCH\n");
  17.     return;
  18.   } else if (half1 > half2) {
  19.     above = true;
  20.   } else {
  21.     above = false;
  22.   }
  23.  
  24.   if (x1 > x2) {
  25.     direction = true;
  26.   } else {
  27.     direction = false;
  28.   }
  29.  
  30.   if (direction == above) {
  31.     printf("RIGHT\n");
  32.   } else {
  33.     printf("LEFT\n");
  34.   }
  35.  
  36.   return;
  37. }
  38.  
  39. int main(void) {
  40.   uint t;
  41.   scanf("%u", &t);
  42.   for (uint i = 0; i < t; i++) {
  43.     thing();
  44.   }
  45.   return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement