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

提取不重复的整数

https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1

#include <stdio.h>
#include <string.h>

int main() {
    char a[9] = {0};
    char b[10] = {0};
    int len;
    int i;

    while (scanf("%s", &a) != EOF) { // 注意 while 处理多个 case
        len = strlen(a);
        for (i = len - 1; i >=0; i-- ) {
           /* 0-9分别作标记,打印没打印过的 */
            if (!b[a[i] - '0']) {
                printf("%c", a[i]);
                b[a[i]- '0'] = 1;
            }

        }
    }
    return 0;
}

全部评论

相关推荐

06-20 14:27
中山大学 C++
rt,day3就开始接需求
星际探神:你就想 你是水货他们都没面出来 他们也水 管他呢
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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