float精度不够,应该使用double #include<bits/stdc++.h> #define PI 3.1415926 using namespace std; int main(){ double r; cin>>r; double V=4.0/3.0*PI*pow(r,3); cout<<fixed<<setprecision(3)<<V<<endl; return 0; }