题解 | #牛牛学数列4#
牛牛学数列4
https://www.nowcoder.com/practice/586b114f52034688879342ba45779081
public class Program { public static void Main() { int result = 0; int inPut = int.Parse(System.Console.ReadLine()); //等差数列求和 for (int i = 1; i <= inPut; i++) { result += i * (1 + i) / 2; } System.Console.WriteLine(result); } }