10 条题解

  • 10
    @ 2023-5-11 21:38:28

    给大家发个精简版,在这段代码中,我使用了 cmath 库中的 M_PI 常量和 ceil() 函数~

    #include <iostream>
    #include <cmath>
    using namespace std;
    int main()
    {
        int h, r;
        cin >> h >> r;
        double v = M_PI * r * r * h; // 求小圆桶的体积
        int n = ceil(20000.0 / v);  // 上取整求需要的桶数
        cout << n << endl;
        return 0;
    }
    

    经典数学问题不必多说了吧……^_^

  • 2
    @ 2025-9-20 18:56:30
    #include <iostream>
    #include <cmath>
    using namespace std;
    int main()
    {
        int h, r;
        cin >> h >> r;
        double V = M_PI * r * r * h; 
        int n = ceil(20000.0 / V);  
        cout << n << endl;
        return 0;
    }
    
    
    • 0
      @ 2023-1-23 15:07:05
      #include <iostream>
      using namespace std;
      int main(){
          int h,r;
          cin>>h>>r;
          cout<<(int)(20*1000/(3.141592653589793238462643*r*r*h)+1);
      }
      
      
      • -1
        @ 2025-7-9 17:19:44

        #include #include #include using namespace std; int main() {

        int a,b;
        cin>>a>>b;
        double v=3.14159*b*b*a;
        cout<<ceil(20.0*1000/v)<<endl;
        return 0;
        

        }

        • -1
          @ 2023-6-10 11:10:20
          #include <stdio.h>
          int main()
          {
          	int h, r, x, v;
          	double PI = 3.14159;
          	scanf("%d %d",&h,&r);
          	v = PI * r * r * h;
          	x = 20000 / v;
          	printf("%d",(int)(x)+1);
          	return 0;
          }
          
          • -1
            @ 2022-11-13 12:39:11
            #include <stdio.h>
            #include <iostream>
            using namespace std;
            int main()
            {
                int h,r;
                cin >> h >> r;
                int c;
                c =  3.14159 * r * r * h ;
                int d;
                d = 20 * 1000 / c;
                cout << d + 1 << endl;
                
            }
            
            • -2
              @ 2025-5-14 21:08:40

              这里的PI我用了前80位的

              # include <bits/stdc++.h>
              
              using namespace std;
              const double PI=3.141592653589793238462643383279502884197169399375105820979230781640628620899;
              int main(){
              	int h,r,d,ans;
              	cin>>h>>r;
              	d=r*r*PI*h;
              	ans=20*1000/d;
              	cout<<ans+1<<endl;
              	return 0;
              }
              
              • -3
                @ 2022-7-17 11:02:52
                
                #include <bits/stdc++.h>
                using namespace std;
                int main()
                {
                    int a,b;
                    cin>>a>>b;
                    double v=3.14159*b*b*a;
                    cout<<ceil(20.0*1000/v)<<endl;
                    return 0;
                }
                
                
                • -4
                  @ 2022-8-2 9:51:15
                  #include <bits/stdc++.h>
                  using namespace std;
                  int main()
                  {
                      int a,b;
                      cin>>a>>b;
                      double v=3.14159*b*b*a;
                      cout<<ceil(20.0*1000/v)<<endl;
                      return 0;
                  }
                  
                  • -5
                    @ 2022-7-17 11:03:15
                    #include <bits/stdc++.h>
                    using namespace std;
                    int main()
                    {
                        int a,b;
                        cin>>a>>b;
                        double v=3.14159*b*b*a;
                        cout<<ceil(20.0*1000/v)<<endl;
                        return 0;
                    }
                    
                    
                    • 1

                    信息

                    ID
                    818
                    时间
                    1000ms
                    内存
                    128MiB
                    难度
                    5
                    标签
                    递交数
                    1292
                    已通过
                    535
                    上传者