4 条题解

  • 1
    @ 2024-3-17 14:18:01
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        double x, n, p;
        cin >> x >> n;
        for (int i = 1; i <= n; i++)
        {
            p = x * 0.001;
            x += p;
        }
        cout << fixed << setprecision(4) << x;
        return 0;
    }
    
    • 1
      @ 2023-8-12 10:42:03

      不用循环

      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          double x,n;
          cin>>x>>n;
          x*=pow(1.001,n);
          cout<<fixed<<setprecision(4)<<x;
          return 0;
      }
      
      • 1
        @ 2023-4-21 21:51:19
        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
            double x,n;
            cin>>x>>n;
            while (n--)
                x*=1.001;
            cout<<fixed<<setprecision(4)<<x;
            return 0;
        }
        • 1
          @ 2022-12-12 18:46:36
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int n;
              double x;
              cin >> x >> n;
              for (int i = 1; i <= n; i++)
              {
                  x += x * 0.001;
              }
              cout << fixed << setprecision(4) << x;
              return 0;
          }
          
          • 1

          信息

          ID
          443
          时间
          1000ms
          内存
          32MiB
          难度
          2
          标签
          递交数
          109
          已通过
          68
          上传者