2 条题解

  • 1
    @ 2026-8-12 14:59:51
    # include <bits/stdc++.h>
    
    using namespace std;
    set<int>q;
    int n,x;
    int main(){
    	cin>>n;
    	while(n--){
    		cin>>x;
    		q.insert(x);
    	}
    	for(auto i : q)
    		cout<<i<<' ';
    	return 0;
    }
    
    • 1
      @ 2026-3-21 21:06:24
      #include <bits/stdc++.h>
      using namespace std;
      
      int a[100005];
      int b[100005];
      
      int main()
      {
          int n;
          cin >> n;
          for (int i = 0; i <= 100005; i++) b[i] = 0;
          for (int i = 1; i <= n; i++)
          {
              cin >> a[i];
              b[a[i]]++;
              if (b[a[i]] > 1) a[i] = -10;
          }
          sort (a + 1, a + n + 1);
          for (int i = 1; i <= n; i++)
          {
              if (a[i] != -10) cout << a[i] << " ";
          }
          cout << endl;
          return 0;
      }
      
      • 1

      信息

      ID
      1013
      时间
      1000ms
      内存
      128MiB
      难度
      6
      标签
      递交数
      32
      已通过
      12
      上传者