题解 | #等差数列#
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <stdio.h> int main() { int n = 0; while (scanf("%d ", &n) != EOF) { // 注意 while 处理多个 case // 64 位输出请用 printf("%lld") to int a1 = 2; int d = 3; int sn = 0; sn = n * a1 + (n * (n - 1) *d / 2); printf("%d\n",sn); } return 0; }