首页 > 编程语言 > 详细

去重排序,这种嵌套的方法非常棒。

时间:2019-11-14 18:29:38      阅读:108      评论:0      收藏:0      [点我收藏+]
技术分享图片
 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4  
 5 int test_student(int *a,int n)
 6 {
 7     int t[1024]={0};
 8     int i;
 9     for (i=0;i<n;i++){
10         t[a[i]] = 1;
11     }
12     for (i=0;i<1024;i++){
13         if(t[i])
14         printf("%d\n",i);
15     }
16     return 0;
17  
18 }
19  
20 int main(int argc, char const *argv[])
21 {
22     int i,n;
23     while(~scanf("%d",&n)&&n>0){
24  
25         int *a=malloc(sizeof(int) * n);
26         for(i=0;i<n;i++){
27             scanf("%d",&a[i]);
28         }
29         test_student(a,n);
30         free(a);
31     }
32     return 0;
33 }
View Code

 

 

去重排序,这种嵌套的方法非常棒。

原文:https://www.cnblogs.com/zhouyuqing1024/p/11820150.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!