1 条题解

  • 0
    @ 2023-6-11 12:20:41

    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

    信息

    ID
    2568
    时间
    1000ms
    内存
    16MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者