题解 | #牛牛学数列4#
牛牛学数列4
http://www.nowcoder.com/practice/586b114f52034688879342ba45779081
#include <stdio.h> int main(){ int n; scanf("%d",&n); int s=0; int sum=0; for(int i=1;i<=n;i++){ s+=i; sum+=s; } printf("%d",sum); return 0; }
牛牛学数列4
http://www.nowcoder.com/practice/586b114f52034688879342ba45779081
#include <stdio.h> int main(){ int n; scanf("%d",&n); int s=0; int sum=0; for(int i=1;i<=n;i++){ s+=i; sum+=s; } printf("%d",sum); return 0; }
相关推荐