牛牛数列4
牛牛学数列4
http://www.nowcoder.com/questionTerminal/586b114f52034688879342ba45779081
其实就是等差数列求和而已
n有多大,就求多少次和
#include <stdio.h>
int main()
{
int n; int sum = 0; int i = 1; int sign = 1; scanf("%d",&n); for(i=1;i<=n;i++) { sum += i*(1+i)/2; } printf("%d\n",sum); return 0;
}