Advertisement
Guest User

I don't understand pcf

a guest
Sep 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. int main () {
  6.     int x1, y1, x2, y2, x3, y3, s1, s2, s3;
  7.     std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  8.     s1 = (x1 - x2) * (x1 - x3) + (y1 - y2) * (y1 - y3);
  9.     s2 = (x1 - x3) * (x3 - x2) + (y1 - y3) * (y3 - y2);
  10.     s3 = (x3 - x2) * (x1 - x2) + (y3 - y2) * (y1 - y2);
  11.     if (s1 + s2 + s3 == 0){
  12.         std::cout << 0;
  13.     } else {
  14.         if (s1 + s2 == 0||s1 + s3 == 0||s2 + s3 == 0) {
  15.             std::cout << 1;
  16.         } else {
  17.             if (x3 - x1 + y2 - y1 == (y3 - y1) * (x2 - x1)) {
  18.                 std::cout << 2;
  19.             } else {
  20.                 if (s1 * s2 * s3 == 0) {
  21.                     std::cout << 4;
  22.                 } else {
  23.                     if (s1 * s2 * s3 < 0) {
  24.                         std::cout << 5;
  25.                     } else {
  26.                         std::cout << 3;
  27.                     }
  28.                 }
  29.             }
  30.         }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement