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