题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int main() {/* string num; cin>>num; int a[10]={0}; for (int i=num.size()-1;i>=0;i--) { int index=((int) (num[i])); a[index]++; if (a[index]==1) cout<<index; }*/ int m; cin>>m; int a[10]={0}; do {int n=m%10; m=m/10; a[n]++; if (a[n]==1) { cout<<n; } }while(m!=0); }