Run ID:108920

提交时间:2025-01-23 16:22:15

#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; // 读取班级中学生的数量 vector<int> scores(n); // 创建一个向量来存储成绩 for (int i = 0; i < n; ++i) { cin >> scores[i]; // 读取每个学生的成绩 } int delIndex; cin >> delIndex; // 读取需要删除的学生学号 // 删除指定学号的学生成绩 if (delIndex >= 1 && delIndex <= n) { scores.erase(scores.begin() + delIndex - 1); } // 输出剩余学生的成绩 for (int score : scores) { cout << score << " "; } cout << endl; // 输出换行 return 0; }