fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const double EPS = 0.001;
  5. struct Point {
  6. double x, y;
  7. };
  8.  
  9. double dist(Point A, Point B) {
  10. return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
  11. }
  12.  
  13. int ccw(Point A, Point B, Point C) {
  14. double k;
  15. k = (B.x - A.x)*(C.y - B.y) - (B.y - A.y) * (C.x - B.x);
  16. if (abs(k) <= EPS) return 0;
  17. if (k < 0) return -1;
  18. return 1;
  19. }
  20. int main() {
  21. Point A, B, C;
  22. cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;
  23. int direction = ccw(A, B, C);
  24. if (direction == 0) cout << "TOWARDS";
  25. else if (direction == -1) cout << "RIGHT";
  26. else cout << "LEFT";
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
TOWARDS