题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include<stdio.h>
int main(void)
{
int sum;
int j = 0;
int temp1[10] = {0};
int temp2[10] = {0};
scanf("%d",&sum);
while(0 != sum)
{
temp1[sum%10] = 1;
temp2[j] = sum%10;
sum = sum/10;
j++;
}
for(int i=0; i<j; i++)
{
if(1 == temp1[temp2[i]])
{
temp1[temp2[i]] = 0;
printf("%d",temp2[i]);
}
}
return 0;
}