杭电OJ确实比我学校的要严格很多啊……
计算球的体积前两次提交没有考虑它会测试r小于0的情况,加上了if语句后就过了。
#include<iostream>
#include<iomanip>
using namespace std;
#define PI 3.1415927
int main()
{
double r;
if (r >= 0)
{
while (cin >> r)
{
double v = 4.000* PI*r*r*r / 3.000;
cout << fixed << setprecision(3) << v << endl;
}
}
return 0;
}