如果你 WA on test 1,检查一下你的 p×xip\times x_ip×xi 是否被强制转换成了 int。
int
(int)(p * x[i]); // 错误 floor(p * x[i] + 1e-6); // 正确