We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8139da4 commit 3295269Copy full SHA for 3295269
_posts/2014-09-12-caculate-ball.md
@@ -0,0 +1,38 @@
1
+---
2
+layout: post
3
+title: 2002.计算球体积
4
+date: 2014-09-12 21:36
5
+categories: 杭电HDU
6
+tags: [杭电HDU]
7
8
+## Problem
9
+>**Problem Description**
10
+根据输入的半径值,计算球的体积。
11
+**Input**
12
+输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。
13
+**Output**
14
+输出对应的球的体积,对于每组输入数据,输出一行,计算结果保留三位小数。
15
+**Sample Input**
16
+1
17
+1.5
18
+**Sample Output**
19
+4.189
20
+14.137
21
+**Hint**
22
+```#define PI 3.1415927```
23
+
24
+## Solution
25
+```cpp
26
+#include<stdio.h>
27
+#define PI 3.1415927
28
+int main(void)
29
+{
30
+ double r,tiji;
31
32
+ while(scanf("%lf",&r)!=EOF){
33
+ tiji=(4*r*r*r*PI)/3;
34
+ printf("%.3lf\n",tiji);
35
+ }
36
+ return 0;
37
+}
38
+```
0 commit comments