解题思路:去重,排序
注意事项:
参考代码:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main()
{
int n,i,count=0,t;
int a[1001]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&t);
if(a[t]==0)
{
a[t]=t;
count++;
}
}
printf("%d\n",count);
for(i=0;i<1001;i++)
{
if(a[i]!=0)
printf("%d ",a[i]);
}
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:376 |
A+B for Input-Output Practice (V) (C语言代码)浏览:625 |
Hello, world! (C语言代码)浏览:714 |
盐水的故事 (C语言代码)浏览:1529 |
P1002 (C语言代码)浏览:961 |
C语言训练-求PI* (C语言代码)浏览:512 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:581 |
用筛法求之N内的素数。 (C语言代码)浏览:577 |
Manchester- 求之N内的素数浏览:1495 |
校门外的树 (C语言代码)浏览:588 |