美文网首页PTA甲级
1035 Password (20 分)

1035 Password (20 分)

作者: zilla | 来源:发表于2019-01-04 17:17 被阅读0次

    超困😴
    这题一点都不提神qaqaqaqaq
    想要一张50元优惠券
    puts()不用\n啦 (复制粘贴🐶的锅


    1035题目链接

    #include <stdio.h>
    #include <string.h>
    const int MAX_LEN = 11;
    int main() {
        char user[1000][MAX_LEN],pass[1000][MAX_LEN];
        int no[1000];
        int n, modified_n = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%s%s", user[i], pass[i]);
        }
        for (int j = 0; j < n; ++j) {
            int l_ = strlen(pass[j]);
            bool mod = false;
            for (int i = 0; i < l_; ++i) {
                switch (pass[j][i]) {
                    case '1':
                        pass[j][i] = '@';
                        mod = true,no[modified_n]=j;
                        break;
                    case '0':
                        pass[j][i] = '%';
                        mod = true,no[modified_n]=j;
                        break;
                    case 'l':
                        pass[j][i] = 'L';
                        mod = true,no[modified_n]=j;
                        break;
                    case 'O':
                        pass[j][i] = 'o';
                        mod = true,no[modified_n]=j;
                        break;
                    default:
                        break;
                }
            }
            if (mod)modified_n++;
        }
        if(modified_n==0)
            if(n!=1)
                printf("There are %d accounts and no account is modified\n",n);
            else puts("There is 1 account and no account is modified");
        else{
            printf("%d\n",modified_n);
            for(int i=0;i<modified_n;i++){
                printf("%s %s\n",user[no[i]],pass[no[i]]);
            }
        }
        return 0;
    }
    

    相关文章

      网友评论

        本文标题:1035 Password (20 分)

        本文链接:https://www.haomeiwen.com/subject/jnskrqtx.html