Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
101809 彭士宝 12序列的第n项 C++ Accepted 1 MS 276 KB 292 2024-12-18 21:56:57

Tests(10/10):


Code:

#include <iostream> using namespace std; int main() { int n, ans = 1; // ans代表第n个数值 cin >> n; // 第几个数 for (int j = 0; j < n - 1; j++) { ans += j; // 累加序列的规律 } cout << ans << endl; // 输出第n项的值 return 0; }