cf-123B

来源:互联网 发布:数据科学与工程学院 编辑:程序博客网 时间:2024/06/14 01:58

点击打开链接    题目


#include <iostream>#include <cmath>#include <algorithm>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 dux2 = 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;}


0 0
原创粉丝点击