egogoboy

телепортация

May 21st, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. bool check(int& x, int& y) {
  5.     if (x == y) {
  6.         if (x < y) {
  7.             std::swap(x, y);
  8.         }
  9.         int temp = x - y;
  10.         if (temp % 2 == 0) {
  11.             return true;
  12.         }
  13.         return false;
  14.     }
  15. }
  16.  
  17. int main() {
  18.  
  19.     std::ifstream fin("input.txt");
  20.     std::ofstream fout("output.txt");
  21.  
  22.     int x1, y1, x2, y2;
  23.  
  24.     fin >> x1 >> y1 >> x2 >> y2;
  25.  
  26.     if ((x1 + y1) % 2 != (x2 + y2) % 2) {
  27.  
  28.         fout << '0' << std::endl;
  29.         return 0;
  30.  
  31.     }
  32.  
  33.     if (abs(x1 - x2) == abs(y1 - y2)) {
  34.         fout << '1' << std::endl;
  35.         return 0;
  36.     }
  37.  
  38.     fout << '2' << std::endl;
  39.     return 0;
  40.    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment