1 条题解

  • 1
    @ 2025-7-30 20:57:20
    #include<bits/stdc++.h> 
    using namespace std;
    int main(){
        bool book[1001]={0};
        int n;	
        int final=0;
        cin>>n;
        int a[n];   
        for(int i=0;i<n;i++){
        	cin>>a[i];
        	if(book[a[i]]==0){  
        		final++;
    	}
        	book[a[i]]=1;
        }
        cout<<final<<endl;
        for(int i=1;i<=1000;i++){  
            if(book[i]==1){
                cout<<i<<" ";
            }
        }
        return 0;
    }
    
    • 1

    信息

    ID
    247
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    (无)
    递交数
    5
    已通过
    3
    上传者