5 条题解

  • 1
    @ 2021-11-14 11:45:12
    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    #include <vector>
    #include <cstring>
    
    using namespace std;
    
    vector<int> v;
    int n;
    
    int main(){
        cin >> n;
        for ( int i = 0; i < n; i ++ ){
            int x; scanf("%d", &x);
            v.push_back(x);
        }
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
        printf("%d\n", v.size());
        for ( auto i : v ) printf("%d ", i);
        return 0;
    }
    
  • 1

    n = int(input())
    c = input()
    a = []
    l = c.split(' ')
    for i in range(0,len(l)):
    a.append(int(l[i]))
    a = list(set(a))
    a.sort()

    print(len(a))

    for i in range(len(a)):
    print(a[i],end=' ')

  • 0
    @ 2023-09-23 19:33:43

    n=input()
    s=set()
    p=input().split()
    l=list(set(p))
    #按照数据大小排序
    l.sort(key=int)
    print(len(l))
    for i in l :
    print(i,end=" ")

  • 0
    @ 2020-09-21 16:27:25
    n=int(input())
    s=[0 for i in range(0,1005)]
    a=input().split()
    ans=n
    
    for i in range(0,n):
        if s[int(a[i])]==1:
            ans-=1;
        s[int(a[i])]=1
        
        
    print(ans)
    for i in range(1,1001):
        if s[i]==1:
            print(i,end=" ")
    
  • 0
    @ 2020-09-16 11:47:51

    a = int(input())
    data = []
    b = input()
    array = b.split(" ")
    def redun(x):
    for i in range(len(data)):
    if data[i] == x:
    return True
    return False

    for i in range(a):
    t = array[i]
    if redun(t)==False:
    data.append(t)
    another = []
    for i in range(len(data)):
    another.append(int(data[i]))
    print(len(another))
    another.sort()
    for i in range(len(data)):
    print(another[i],end=" ")

  • 1

信息

ID
1026
难度
8
分类
(无)
标签
(无)
递交数
153
已通过
21
通过率
14%
上传者