8 条题解

  • 7
    @ 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;
    }
    

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

  • 0
    @ 2024-3-3 21:38:53

    #include<bits/stdc++.h> #include <iostream> #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> #include<cstdio> #include<fstream> #include<cmath> #include<cstring> #include<map> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; 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-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;
      }
      
      • 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
          @ 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;
              
          }
          
          • -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;
            }
            
            • -4
              @ 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;
              }
              
              
              • -6
                @ 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
                标签
                递交数
                1042
                已通过
                417
                上传者