15 条题解
-
0江铭扬 (jmy123) LV 4 @ 2024-10-13 18:58:10
- #include<iostream> using namespace std; int main(){ int n; cin>>n; int ans=1; int sum=0; for(int i=1;i<=n;i++) { ans*=i; sum+=ans; } cout<<sum; }
-
02024-10-13 18:57:19@
#include<iostream> using namespace std; int main(){ int n; cin>>n; int ans=1; int sum=0; for(int i=1;i<=n;i++) { ans*=i; sum+=ans; } cout<<sum; }
-
02024-10-13 18:09:19@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin>>n; int ans =1; int sum =0; for(int i = 1 ; i <= n ; i++) { ans *=i; sum += ans; } cout<< sum << endl; }
-
02024-3-11 21:11:15@
#include <iostream> #include <stdio.h> #include <math.h> #include <iomanip> using namespace std; int m , n , ans; int main() { cin >> m >> n; for( int i = m ; i <= n ; i++ ) { if( i % 17 == 0 ) { ans += i; } } cout << ans; return 0; }
-
02023-6-2 19:11:29@
兄弟们,为什么ans和sum不能开long long,int就行?大佬求解 longlong代码:(错的,不要复制)
#include <iostream> #include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int main() { int n; long long sum=1,ans; cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { sum*=j; } ans+=sum; sum=1; } cout<<ans; }
int代码:
#include <iostream> #include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int main() { int n; int sum=1,ans; cin>>n; for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { sum*=j; } ans+=sum; sum=1; } cout<<ans; }
-
02023-4-12 20:03:16@
#include<iostream> using namespace std; int n,ans,jc=1; int main(){
cin >> n; for(int i = 1;i <= n;i++) { jc = 1; for(int j = 1;j <=i;j++) { jc*=j; } ans +=jc; } cout<<ans; return 0;
}
-
02023-4-1 12:20:41@
#include <iostream> #include <iomanip> using namespace std; int main() { int n,sum=0,m=1; cin>>n; for(int i=1; i<=n; i++)//常用i,j,k { m*=i; sum+=m; } cout<<sum; return 0; }
-
-12023-4-12 20:02:19@
using namespace std; int main() { int n; cin >> n; int ans = 1; int jc=0 ; for (int i = 1; i <= n; i++) { ans *=i; jc += ans; } cout << jc; }
-
-22022-4-17 17:32:39@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 1; int sum = 0; for (int i = 1; i <= n; i++) { ans *=i; sum += ans; } cout << sum << endl; }
-
-32023-1-3 13:05:47@
#include<bits/stdc++.h> using namespace std; int n; long long jc(int n) { if(n==1)return 1; long long sum=1; for(int i=2;i<=n;i++)sum*=i; sum+=jc(n-1); return sum; } int main() { cin>>n; long long ans=jc(n); cout<<ans; return 0; }
-
-52022-1-8 11:54:13@
#include <iostream> #include <math.h> #include <iomanip> using namespace std; #define LL Long Long const int N=1e5+10; const int INF=0x3f3f3f3f; int main() { int n; cin >> n; int ans = 1; int sum = 0; for(int i = 1 ; i <= n ; i++) { ans *= i; sum += ans; } cout << sum << endl; }
-
-52022-1-8 11:54:10@
#include <stdio.h> #include <iostream> #include <math.h> using namespace std; int main() { int n; cin>>n; int ans=1; int sum=0; for(int i=1;i<=n;i++) { ans*=i; sum+=ans; } cout<<sum; }
-
-62022-1-8 15:39:38@
打表义不容辞#include<iostream> using namespace std; int n[13] = {0,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600}; int k, sum; int main(){ cin >> k; for(int i = 1; i <= k; i++){ sum += n[i]; } cout << sum; return 0; }
-
-82022-1-8 11:56:03@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 1; int sum = 0; for(int i = 1 ; i <= n ; i++) { ans *= i; sum += ans; } cout << sum << endl; }
-
-82022-1-8 11:53:19@
#include <stdio.h> #include <iostream> using namespace std; int main() { int n; cin >> n; int ans = 1; int sum = 0; for (int i = 1; i <= n; i++) { ans *=i; sum += ans; } cout << sum << endl; }
- 1
信息
- ID
- 932
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 676
- 已通过
- 320
- 上传者