Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
101808 | 彭士宝 | 12序列的第n项 | C++ | Wrong Answer | 0 MS | 268 KB | 267 | 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; }
------Input------
5
------Answer-----
7
------Your output-----
11