7 条题解

  • 3
    @ 2024-8-17 18:04:29
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;
    	double sum=0.0;
    	int a=1;
    	cin>>n;
        for (int i = 1; i <= n; i++) {  
            a*=i; 
            sum+=1.0/a;
        } 
    	cout<<fixed<<setprecision(5)<<sum;
    }
     
    
    • 1
      @ 2024-11-25 13:26:22

      #include<bits/stdc++.h> using namespace std; int main() { double n,a,b; cin>>n; for(int i=1;i<=n;i++) { a=1; for(int j=1;j<=i;j++) { a=a*j; } b=b+1.00000/a; a=1; } cout<<fixed<<setprecision(5)<<b; return 0; }

      • 0
        @ 2024-11-26 13:37:30

        #include<bits/stdc++.h> using namespace std; int main() { double n,s=1,w=0; cin>>n; for(int i=1;i<=n;i++) { for(int r=1;r<=i;r++) { s=s/r; } w=w+s; s=1; } cout<<fixed<<setprecision(5)<<w; return 0; }

        • 0
          @ 2024-11-25 13:37:46

          #include<bits/stdc++.h> using namespace std; int main() { int n,c; double a=1.0,s=0.0; cin>>n; for(int i=1;i<=n;i++) { a=1; for(int j=1;j<=i;j++) { a=a*j; } s=s+1.0/a; } cout<<fixed<<setprecision(5)<<s; return 0; }

          • 0
            @ 2024-11-15 17:50:18
            #include<bits/stdc++.h>
            using namespace std;
            int main()
            {
            	double a,n,s=0;
            	cin>>n;
            	for(int i=1;i<=n;i++)
            	{
            		a=1;
            		for(int j=1;j<=i;j++)
            		{
            			a=a*j;
            		}
            		s=s+1.0/a;
            	    a=1;
            	}
            	cout<<fixed<<setprecision(5)<<s<<endl;
            	return 0;
            }
            
            • 0

              无数据

              • 0
                @ 2024-1-1 0:28:41

                无测试结果

                • 1

                信息

                ID
                67
                时间
                1000ms
                内存
                256MiB
                难度
                5
                标签
                递交数
                144
                已通过
                59
                上传者