計算球體積
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 127739 Accepted Submission(s): 52142
Problem Description
根據輸入的半徑值,計算球的體積。
Input
輸入資料有多組,每組占一行,每行包括一個實數,表示球的半徑。
Output
輸出對應的球的體積,對于每組輸入資料,輸出一行,計算結果保留三位小數。
Sample Input
1
1.5
Sample Output
4.189
14.137
Hint
#define PI 3.1415927
Author
lcy
AC代碼:
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<algorithm>
typedef long long LL;
using namespace std;
#define PI 3.1415927
int main()
{
double r;
double ans;
while(cin>>r){
ans=(4*PI*r*r*r)/3;
printf("%.3lf\n",ans);
}
return 0;
}