Closest Pair 解题小记:C++运行错误:process returned -1073741571 且 函数计算错误

mac2025-03-23  14

C++运行出现错误:process returned -1073741571 且 函数计算错误

小记:

求点对之间的最近距离的时候,当输入量为500000或5000000时,会出现运行到一半停止的情况

原因:内存溢出,数组的定义过大了。

解决方法:将其定义为static或全局变量

struct Point{ unsigned int x, y; }; static Point p[5000000];

在计算距离的时候由于数据过大导致计算失败,输出一直错误。 解决方法:

static double Distance(){}

修改完:

最新回复(0)