注意 double 精度问题。当然,你也可能像我一样犯蠢,写出了 const int eps=1e-9 这句神奇的代码。
const int eps=1e-9
这里提供一段:
const double eps=1e-9; inline int cmp(double x, double y) { if(x-y > eps) return 1; if(y-x > eps) return -1; return 0; }