hdu2002 計算球體積【C++】
阿新 • • 發佈:2018-07-09
amp problem color ott The panel sca std cep
#define PI 3.1415927
計算球體積
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 194043 Accepted Submission(s): 76838
Input 輸入數據有多組,每組占一行,每行包括一個實數,表示球的半徑。
Output 輸出對應的球的體積,對於每組輸入數據,輸出一行,計算結果保留三位小數。
Sample Input 1 1.5
Sample Output 4.189 14.137 Hint
1 #include<cstdio> 2 const double PI = 3.1415927; 3 int main() 4 { 5 double r; 6 while(scanf("%lf",&r)!=EOF) 7 { 8 double v = (1.0)*4/3*PI*r*r*r; 9 printf("%.3f\n",v); 10 } 11 return 0; 12 }
hdu2002 計算球體積【C++】