9个数据 不会了其他的
这个代码过不了的
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
int w, m, n;
int roow(int c, int x)
{
int row;
if(c % 2 == 0 || c == 0)
{
if(x > w)
row = x % w - 1; //x - (x % w) + 1;
else row = x;
}
else if(c == 1 || c % 2 != 0)
row = (w + 1) - (x % w) - 1;
}
int main()
{
LL res = 0;
cin >> w >> m >> n; //n, m待计算的楼层号, w为排号宽度
//先判断两个点的楼层号
int ml = m / w;
int nl = n / w;
int heigh = abs(ml - nl); //两点距离的高度, m = 8, n = 2
res = abs(roow(ml, m) - roow(nl, n)) + heigh;
/*cout << "ml=" << ml << endl;
cout << "nl=" << nl << endl;
cout << roow(ml, m) << ' ' << roow(nl, n) << endl;*/
cout << res;
return 0;
}