#include <iostream> #include <cmath> #include <algorithm> using namespace std; int main() {int x1, y1, x2, y2;cin >> x1 >> y1 >> x2 >> y2; // 读取两个点的坐标 int dx = abs(x2 - x1);int dy = abs(y2 - y1);// 坐标差值 int manhattan = dx + dy;// 曼哈顿距离int chebyshev = max(dx, dy);// 切比雪夫距离cout << manhattan << " " << chebyshev << endl;return 0; }
#include <iostream> using namespace std;int main() {int total_minutes = 0;for (int i = 0; i < 3; i++) {//读取时间段int h1, m1, h2, m2;cin >> h1 >> m1 >> h2 >> m2;int start_m = h1 * 60 + m1;int end_m = h2 * 60 + m2;total_m += (end_m - start_m);}int hours = total_m / 60;int minutes = total_m% 60; // 转换成小时和分钟cout << hours << " " << minutes << endl;if (hours >= 4) {// 判断结果cout << "YES" << endl;} else {cout << "NO" << endl;}
}
#include <iostream> using namespace std; int main(){cout<<"Hello excellent athletes!"<<endl;cout<<"Hello excellent acmers!"<<endl;cout<<"Welcome to HZNU!"<<endl;return 0; }