3 solutions

  • 0
    @ 2025-12-31 22:58:33
    #include <iostream>
    using namespace std;
    
    const double PI = 3.14159; //定义圆周率(π)
    double r;				 //定义r
    
    int main() {
    	cin >> r;//输入r
    	printf("%.4lf ", r * 2.0);		//直径
    	printf("%.4lf ", 2.0 * r * PI);	//周长
    	printf("%.4lf ", r * r * PI);	//面积
    	return 0;
    }
    
    • 0
      @ 2025-12-31 22:56:51

      http://oj.mqcoj.cn:5000/p/P28

      #include <bits/stdc++.h>//万能头文件,但不是万能的~
      using namespace std;//标准命名空间。
      
      const double PI = 3.14159; //定义圆周率常量(π)
       double r;				 //定义半径
       
      int main() {
      
       	cin >> r;//输入r
      	printf("%.4lf ", r * 2.0);		//直径
      	printf("%.4lf ", 2.0 * r * PI);	//周长
       	printf("%.4lf ", r * r * PI);	//面积
       	return 0;
       }
      
      • 0
        @ 2025-10-29 11:24:58
        #include<iostream>
        #include<iomanip>
        using namespace std;
        int main(){
            const double a = 3.14159;//const修饰的变量或对象运行过程中不能修改。
            double r, diameter, circumference, area;
            cin>>r;
            diameter = 2*r;
            circumference = 2*r*a;
            area = a*r*r;
            cout<<fixed<<setprecision(4)<<diameter<<" "<<circumference<<" "<<area<<endl;
            return 0;
        }
        
        • 1

        Information

        ID
        315
        Time
        1000ms
        Memory
        128MiB
        Difficulty
        6
        Tags
        # Submissions
        644
        Accepted
        220
        Uploaded By