参考答案

tianchenrui 2025-07-25 12:08:32 2025-07-25 12:09:02 2

#include <bits/stdc++.h> using namespace std; int main() { int n, x, c; cin >> n; int a[n]; for (int i = 1; i <= n; i++) { cin >> a[i]; } cin >> x; for (int i = 1; i <= n; i++) { if (a[i] == x) { c = x; continue; } else { cout << a[i] << " "; } } cout << c; return 0; }

{{ vote && vote.total.up }}