daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <conio.h>
  3. //#include <math.h>
  4.  
  5. using std::cout;
  6. using std::cin;
  7.  
  8. int main()
  9. {
  10.     int k,l,m,n,x,y,x1,y1;
  11.     cout<<"Vvedite (k,l) (m,n)\n";
  12.     cin>>k>>l>>m>>n;
  13.     x=1;
  14.     y=1;
  15.     if (((k+l)&1&&(m+n)&1)||((k+l)%2==0&&(m+n)%2==0)) {
  16.         if(abs(m-k)==abs(n-l))
  17.             cout<<"S polya (k,l) za odin hod vozmozhno popast na pole (m,n)";
  18.         else {
  19.             x1=1;
  20.             y1=1;
  21.         }
  22.  
  23.        for (int i=x1; i<=8; i++)
  24.             if(abs(k-i)==abs(l-n)) {
  25.                 x=i;
  26.                 y=n;
  27.             }
  28.             else
  29.                 cout<<1<<" "<<1;
  30.  
  31.  
  32.         for (int i=y1; i<=8; i++)
  33.             if(abs(k-m)==abs(l-i)) {
  34.                 x=m;
  35.                 y=i;
  36.             }
  37.             else
  38.                 cout<<1<<" "<<1;
  39.  
  40.        cout<<x<<" "<<y;
  41.  
  42.     }
  43.     else
  44.         cout<<"Nevozmozhno s polya (k,l) popast na pole (m,n)";
  45.     _getch();
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand