Run ID:101808

提交时间:2024-12-18 21:51:54

#include <iostream> using namespace std; int main() { int n; cin >> n; // 读取用户输入的正整数n // 计算序列的第n项 int nthTerm = 1 + (n * (n - 1)) / 2; cout << nthTerm << endl; // 输出第n项的值 return 0; }