Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- //#include <math.h>
- using std::cout;
- using std::cin;
- int main()
- {
- int k,l,m,n,x,y,x1,y1;
- cout<<"Vvedite (k,l) (m,n)\n";
- cin>>k>>l>>m>>n;
- x=1;
- y=1;
- if (((k+l)&1&&(m+n)&1)||((k+l)%2==0&&(m+n)%2==0)) {
- if(abs(m-k)==abs(n-l))
- cout<<"S polya (k,l) za odin hod vozmozhno popast na pole (m,n)";
- else {
- x1=1;
- y1=1;
- }
- for (int i=x1; i<=8; i++)
- if(abs(k-i)==abs(l-n)) {
- x=i;
- y=n;
- }
- else
- cout<<1<<" "<<1;
- for (int i=y1; i<=8; i++)
- if(abs(k-m)==abs(l-i)) {
- x=m;
- y=i;
- }
- else
- cout<<1<<" "<<1;
- cout<<x<<" "<<y;
- }
- else
- cout<<"Nevozmozhno s polya (k,l) popast na pole (m,n)";
- _getch();
- }
Add Comment
Please, Sign In to add comment