题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <stdio.h> #include <string.h> int main() { int a; int b; int arr[10]; memset(arr,-1,10*sizeof(int)); scanf("%d",&a); int new_num=0; while(a>0) { b= a%10; if(arr[b]==1){ a /=10; continue; } else{ arr[b] = 1; new_num = new_num*10+b; } a /=10; } printf("%d",new_num); return 0; }