SDUT1130数据结构上机测试1:顺序表的应用

来源:互联网 发布:淘宝卖土特产的代价 编辑:程序博客网 时间:2024/06/05 07:14
#include<bits/stdc++.h>using namespace std;int main(){    int n,a[1050],hash[1050],k=0;    scanf("%d",&n);    for(int i=0; i<n; i++)    {        scanf("%d",&a[i]);        hash[a[i]]=1;    }    for(int i=0; i<n; i++)        if(hash[i])k++;    printf("%d\n",k);    memset(hash,0,sizeof(hash));    for(int i=0; i<n; i++)        if(!hash[a[i]])    {        printf("%d ",a[i]);        hash[a[i]]=1;    }}

0 0
原创粉丝点击