2 条题解

  • 2
    @ 2026-6-9 22:36:35
    #include<bits/stdc++.h> 
    using namespace std;
    int main(){
     int n;
        cin >> n;         
        int a[1000];      
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        int m;
        cin >> m;
        bool deleted = false;
        for (int i = 0; i < n; i++) {
            if (a[i] == m && !deleted) {
                deleted = true; 
            } else {
                cout << a[i] << " ";
            }
        }
        
            return 0;
             }
    
    
    • -3
      @ 2026-6-5 20:05:50

      #include using namespace std; int a [1005];

      int main() { int n, m; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; cin >> m; bool flag = false; for (int i = 1; i <= n; i++) { if (a[i] == m && !flag) { flag = true; continue; } cout << a[i] << " "; } return 0; }

      • 1

      信息

      ID
      30979
      时间
      1000ms
      内存
      256MiB
      难度
      6
      标签
      (无)
      递交数
      93
      已通过
      28
      上传者