fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <vector>
  4.  
  5. class punkt
  6. {
  7. private:
  8. float X, Y;
  9. public:
  10. punkt(float x, float y) : X(x), Y(y) {}
  11. float & get_X() {
  12. return X;
  13. }
  14. float & get_Y() {
  15. return Y;
  16. }
  17. ~punkt(){};
  18. };
  19.  
  20. int main() {
  21. float t, temp_x, temp_y;
  22. std::string input;
  23. float a, b;
  24. std::vector<punkt> points;
  25. std::cin >> t;
  26. for (int i = 0; i < t; ++i) {
  27. std::getline(std::cin, input);
  28. std::stringstream stream(input);
  29. for (int j = 0; j < 3; ++j) {
  30. stream >> temp_x >> temp_y;
  31. points.push_back(punkt(temp_x, temp_y));
  32. }
  33. // y = ax + b
  34. a = (points[0].get_Y() - points[1].get_Y()) / (points[0].get_X() - points[1].get_X());
  35. b = points[0].get_Y() - a * points[0].get_X();
  36. if (points[2].get_Y() == a * points[2].get_X() + b) {
  37. std::cout << "TAK";
  38. }
  39. else {
  40. std::cout << "NIE";
  41. }
  42. }
  43. return 0;
  44. }
Success #stdin #stdout 0s 4564KB
stdin
8
10.1 20.2
10.1 20.2
10.1 20.2
10.1 20.2
10.1 20.2
10.1 20.2
10.1 20.2
10.1 20.2
stdout
NIENIENIENIENIENIENIENIE