题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include<stdio.h>
//num[20] size -1 flag N
//N%10 and != 去重 push num
int main(){
int num[20],size=-1,flag,N;
int t;
scanf("%d",&N);
while(N!=0){
t = N%10;
flag=0;
for(int i=0;i<=size;i++){
if(t==num[i])
{flag=1;
break;}
}
if(flag ==0)
num[++size]=t;
N /=10;
}
//output
for(int i=0;i<=size;i++){
printf("%d",num[i]);
}
}