#include #include using namespace std; typedef long long LL; int X,Y; LL dist(int x1,int y1,int x2,int y2){ return (x1-x2)*(x2-x2)+(y1-y2)*(y1-y2); } bool canGoTo(int x,int y,int &num) { if (x==X && y==Y){ cout<<"YES"<> myVec; myVec.push_back(make_pair(x-2,y-1)); myVec.push_back(make_pair(x-2,y+1)); myVec.push_back(make_pair(x-1,y-2)); myVec.push_back(make_pair(x-1,y+2)); myVec.push_back(make_pair(x+1,y-2)); myVec.push_back(make_pair(x+1,y+2)); myVec.push_back(make_pair(x+2,y-1)); myVec.push_back(make_pair(x+2,y+1)); for (int i=0;idistXY){ distMin=distXY; xMin=x-2; yMin=y-1; } distXY=dist(X,Y,x-2,y+1); if (distMin>distXY){ distMin=distXY; xMin=x-2; yMin=y+1; } distXY=dist(X,Y,x-1,y-2); if (distMin>distXY){ distMin=distXY; xMin=x-1; yMin=y-2; } distXY=dist(X,Y,x-1,y+2); if (distMin>distXY){ distMin=distXY; xMin=x-1; yMin=y+2; } distXY=dist(X,Y,x+1,y-2); if (distMin>distXY){ distMin=distXY; xMin=x+1; yMin=y-2; } distXY=dist(X,Y,x+1,y+2); if (distMin>distXY){ distMin=distXY; xMin=x+1; yMin=y+2; } distXY=dist(X,Y,x+2,y-1); if (distMin>distXY){ distMin=distXY; xMin=x+2; yMin=y-1; } distXY=dist(X,Y,x+2,y+1); if (distMin>distXY){ distMin=distXY; xMin=x+2; yMin=y+1; } return canGoTo(xMin,yMin,num); } int main(int argc, char* argv[]) { cin>>X>>Y; int num=1; canGoTo(0,0,num); return 0; }