```cpp #include <iostream> using namespace std; int main() { int n; cin >> n; int heights[n]; for (int i = 0; i < n; i++) { cin >> heights[i]; } int ttingHeight; cin >> ttingHeight; int frontCount = 0, backCount = 0; for (int i = 0; i < n; i++) { if (heights[i] < ttingHeight) { frontCount++; } else if (heights[i] == ttingHeight) { backCount++; } } int frontPosition = frontCount + 1; int backPosition = frontCount + backCount; cout << frontPosition << " " << backPosition << endl; // 额外注意: // 1. 注意输入数据的合法性检查。 // 2. 考虑使用更高效的数据结构,如排序后的数组。 // 3. 对于大规模数据,要注意算法的时间和空间复杂度。 return 0; } ``` [2025-01-14 10:49:37 | AI写代码神器 | 263点数解答]