diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-07-06 19:08:08 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-07-06 19:08:08 +0200 |
| commit | 96254947699986c59f0dc63d69fd4b76bd3ed43e (patch) | |
| tree | 6c4dca945d7f7427c48be234d827fe4d33be02c5 /09_geometry/point_location_test_2189.cpp | |
| download | cses-96254947699986c59f0dc63d69fd4b76bd3ed43e.tar.gz cses-96254947699986c59f0dc63d69fd4b76bd3ed43e.zip | |
Initial commit
Diffstat (limited to '09_geometry/point_location_test_2189.cpp')
| -rw-r--r-- | 09_geometry/point_location_test_2189.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/09_geometry/point_location_test_2189.cpp b/09_geometry/point_location_test_2189.cpp new file mode 100644 index 0000000..998abb8 --- /dev/null +++ b/09_geometry/point_location_test_2189.cpp | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #include <iostream> | ||
| 2 | |||
| 3 | struct Point { | ||
| 4 | long long x; | ||
| 5 | long long y; | ||
| 6 | Point operator-(const Point& p) const { return Point{x-p.x, y-p.y}; } | ||
| 7 | long long operator*(const Point& v) { return x * v.y - y * v.x; } | ||
| 8 | }; | ||
| 9 | |||
| 10 | int main() { | ||
| 11 | int t; | ||
| 12 | Point a, b, c; | ||
| 13 | std::cin >> t; | ||
| 14 | for (int i = 0; i < t; i++) { | ||
| 15 | std::cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y; | ||
| 16 | auto v = (b-a)*(c-a); | ||
| 17 | if (v > 0) std::cout << "LEFT\n"; | ||
| 18 | else if (v < 0) std::cout << "RIGHT\n"; | ||
| 19 | else std::cout << "TOUCH\n"; | ||
| 20 | } | ||
| 21 | } | ||
