22159 牛牛学数列4
牛牛学数列4
https://ac.nowcoder.com/acm/problem/22159
#include<bits/stdc++.h> using namespace std; int main() { int n,a,b,i,j; cin>>n; for(i=1;i<=n;i++) { b=0; for(j=1;j<=i;j++) b+=j; a+=b; } cout<<a<<endl; return 0; }
牛牛学数列4
https://ac.nowcoder.com/acm/problem/22159
#include<bits/stdc++.h> using namespace std; int main() { int n,a,b,i,j; cin>>n; for(i=1;i<=n;i++) { b=0; for(j=1;j<=i;j++) b+=j; a+=b; } cout<<a<<endl; return 0; }
相关推荐