题解 | #等差数列#
等差数列
http://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
等差求和公式 S = na +n(n-1)/2d 或者 S=(a1 +an)/2n
while True: try: n = int(input()) a = 2 d = 3 s = n * a + n * (n - 1) / 2 * d print(int(s)) except: break
等差数列
http://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
等差求和公式 S = na +n(n-1)/2d 或者 S=(a1 +an)/2n
while True: try: n = int(input()) a = 2 d = 3 s = n * a + n * (n - 1) / 2 * d print(int(s)) except: break
相关推荐