题解 | #等差数列#
等差数列
https://www.nowcoder.com/practice/f792cb014ed0474fb8f53389e7d9c07f
#include <iostream> using namespace std; int main() { int a1 = 2, d = 3; int n; cin >> n; int Sn = n*a1 + (n*(n-1)/2)*d; cout << Sn << endl; } // 64 位输出请用 printf("%lld")