本文共 767 字,大约阅读时间需要 2 分钟。
题目
#include#include #include typedef long long ll;using namespace std;int main() { ll a, b, x, y, x1, y1, x2, y2; cin >> a >> b >> x1 >> y1 >> x2 >> y2; x = x1, y = y1; // xuan zhuang 45 du x1 = x + y; y1 = y - x;// cout << x1 << " " << y1 << endl; x = x2, y = y2; // xuan zhuang 45 du x2 = x + y; y2 = y - x;// cout << x2 << " " << y2 << endl; a *= 2; b *= 2; x1 = x1 / a + (x1 > 0); // 判断 x1 ,x2,y1,y2 shi fou zai tong yi ce ,if yes ,+1 ;or + 0; x2 = x2 / a + (x2 > 0); y1 = y1 / b + (y1 > 0); y2 = y2 / b + (y2 > 0);// cout << x1 << " " << x2 << " " << y1 << " " << y2 << endl; cout << max(abs(y2 - y1), abs(x2 - x1)) << endl; // de dao jie guo qu zui da zhi return 0;}