2 solutions

  • 0
    @ 2024-9-28 11:53:52
    #include<bits/stdc++.h>
    using namespace std;
    int main ()
    {
        double n,e=1,j=1;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            j*=i;
            e+=1.0/j;
        }
        cout<<fixed<<setprecision(10)<<e;
        return 0;
    }
    
    • -2
      @ 2025-1-12 14:52:18
      #include<bits/stdc++.h>
      using namespace std;
      int main ()
      {
          double n,e=1,j=1;
          cin>>n;
          for(int i=1;i<=n;i++)
          {
              j*=i;
              e+=1.0/j;
          }
          cout<<fixed<<setprecision(10)<<e;
          return 0;
      }
      
      
      • 1

      Information

      ID
      888
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      42
      Accepted
      28
      Uploaded By