题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
使用unordered_set来去除重复的整数
#include <iostream>
#include <unordered_set>
using namespace std;
int main() {
int input = 0;
cin >> input;
unordered_set<int> hash;
int res = 0;
while(input){
int backend = input % 10;
if(hash.find(backend) == hash.end()){
res *= 10;
res += backend;
hash.insert(backend);
}
input /= 10;
}
cout << res << endl;
}
// 64 位输出请用 printf("%lld")


