题解 | #提取不重复的整数#

提取不重复的整数

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")

全部评论

相关推荐

哇哇的菜鸡oc:他这不叫校招offer,而是实习offer
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务