Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
101816 | 彭士宝 | 12序列找规律 | C++ | Wrong Answer | 1 MS | 268 KB | 526 | 2024-12-18 22:05:31 |
#include <iostream> using namespace std; int main() { int n; cin >> n; // 读取用户输入的正整数n int group = (n + 1) / 2; // 确定第n项属于哪一组 int first_in_group = 10000 - 2 * (group - 1); // 计算组内第一个数字的值 // 根据n的奇偶性确定第n项的值 if (n % 2 == 1) { cout << first_in_group << endl; // 组内的第一个数字 } else { cout << first_in_group - 1 << endl; // 组内的第二个数字 } return 0; }
------Input------
5
------Answer-----
9998
------Your output-----
9996