2 solutions

  • 0
    @ 2026-7-9 15:35:04
    #include<bits/stdc++.h>
    using namespace std;
    int s1[1010]; 
    int main()
    {
        int n,m;
        bool b=true;
        cin>>n>>m;
        for(int i=1;i<=m;i++){
            int a;
            cin>>a;
            s1[a]=-1;
        }
        for(int i=1;i<n;i++){
            if(s1[i]!=-1) {
                cout<<i<<' ';
                b=false;
            }
        }
        if(b) cout<<n;
        return 0;
    }
    
    • -1
      @ 2026-6-20 13:42:03
       #include<bits/stdc++.h>
      using namespace std;
      int a[1010],b[1010];
      int main()
      {
          int e,f;
          cin>>e>>f;
          int e1=0;
          for(int i=0;i<f;i++)
          {
              cin>>b[i];
              a[b[i]]=1;
          }
          for(int j=0;j<e;j++)
          {
             
              if(a[j]==0)
              {
                  cout<<j<<" ";
              }
              if(a[j]==1)
              {
                  e1++;
              }
              if(e1==e)
              {
                  cout<<e;
                  return 0;
              }
          }
          return 0; //看过的请给我点👍
      }
      
      
      
      • 1

      Information

      ID
      1180
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      1
      Tags
      (None)
      # Submissions
      57
      Accepted
      22
      Uploaded By