题解 | #提取不重复的整数#
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
#include <iostream>
using namespace std;
int main() {
int num;
int a[10] = {0};
while (cin >> num ) { // 注意 while 处理多个 case
while (num / 10) {
int reminder = num % 10;
if (a[reminder] == 0) {
cout << reminder;
a[reminder] = 1;
}
num = num/10;
}
if(num > 0 && a[num] == 0) cout << num;
cout << endl;
}
}
// 64 位输出请用 printf("%lld")
查看14道真题和解析