HJ9 提取不重复的整数 | 杂乱无章的初级程序员的题解
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream> #include <bitset> using namespace std; int main() { bitset<10> exist(0); uint32_t n, result = 0u; cin >> n; while (n > 0) { auto i = n % 10; if (!exist.test(i)) { exist.flip(i); result = result * 10 + i; } n /= 10; } cout << result << endl; }#华为机试#