1 solutions
-
0
C :
#include<stdio.h> int main() { int a,b; scanf("%d%d",&a,&b); printf("%.2f", 3.1415926*2*a*(a+b)); return 0; }
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ int r,h; double pi = 3.1415926; cin>>r>>h; cout<<fixed<<setprecision(2); cout<<2*r*pi*h + r*r*pi*2; return 0; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double r = sc.nextDouble(); double h = sc.nextDouble(); double c = 2 * 3.1415926 * r; double s = 3.1415926 * r * r; double t = c * h + s * 2; System.out.println(String.format("%.2f", t)); } }
Python :
r,h = map(float,input().split()) pi = 3.1415926 S = pi*r*r*2 + 2*pi*r*h print('%.2f'% S)
- 1
Information
- ID
- 10227
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By