找规律 转换一下
#include<iostream>
#include<cmath>
using namespace std;
const int N =1e4+5;
int main()
{
int w,m,n;
while(cin>>w>>m>>n)
{
int line1=(m+w-1)/w;//2
int line2=(n+w-1)/w;//1
//cout<<line1<<" "<<line2<<endl;
if(line1%2==0)
{
m=(2*line1-1)*w-m+1;//11
//cout<<m<<endl;
}
if(line2%2==0)
{
n=(2*line2-1)*w-n+1;//2
// cout<<n<<endl;
}
int x1=line1,y1=m%w;
int x2=line2,y2=n%w;
cout<<abs(x1-x2)+abs(y1-y2)<<endl;
}
return 0;
}