Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
106277 彭士宝 07切比雪夫距离 C++ Compile Error 0 MS 0 KB 631 2025-01-15 21:05:14

Tests(0/0):


Code:

#include <iostream> #include <cstdlib> // 包含abs函数 #include <algorithm> // 包含max函数 using namespace std; // 计算两个点的切比雪夫距离 int chebyshevDistance(int a, int b, int c, int d) { // 计算两个点的坐标差值的绝对值 int difference_x = abs(a - c); int difference_y = abs(b - d); // 选择较大值作为切比雪夫距离 return max(difference_x, difference_y); } int main() { int a, b, c, d; // 输入 cin >> a >> b >> c >> d; // 计算并输出切比雪夫距离 cout << chebysDistance(a, b, c, d) << endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:21:38: error: 'chebysDistance' was not declared in this scope
     cout << chebysDistance(a, b, c, d) << endl;
                                      ^