1 solutions
-
0
C :
#include<stdio.h> int main(){ int i,T; double R,v; scanf("%d",&T); for(i=1;i<=T;i++){ scanf("%lf",&R); v=3.1415927*R*R*R*4/3; printf("%.3lf\n",v); } }C++ :
#include <stdio.h> #define pi 3.1415927 int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); double r; int t; scanf("%d",&t); while (t--) { scanf("%lf",&r); double s; s=4*pi*r*r*r/3; printf("%.3f\n",s); } return 0; }Java :
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner reader=new Scanner(System.in); double PI=3.1415927; int T=reader.nextInt(); for(int i=0;i<T;i++){ double a=reader.nextDouble(); double b=a*a*a*PI*(4.0/3.0); System.out.printf("%.3f",b); System.out.println(); } } }
- 1
Information
- ID
- 16914
- Time
- 2000ms
- Memory
- 2048MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By