zoukankan      html  css  js  c++  java
  • PAT 1034

    注意看后面output的要求OTL

    陈越姥姥我都不太想吐槽你了... 

     1 #include <vector>
     2 #include <iostream>
     3 #include <string>
     4 #include <fstream>
     5 
     6 #define OJ
     7 
     8 #ifdef OJ
     9 #define fin cin
    10 #endif
    11 
    12 using namespace std;
    13 
    14 class User{
    15 public:
    16     User(){
    17         modified = false;
    18     }
    19 
    20     string name;
    21     string passwd;
    22     bool modified;
    23 };
    24 
    25 vector<User> users;
    26 
    27 int main(){
    28 #ifndef OJ
    29     ifstream fin;
    30     fin.open("in.data");
    31 #endif
    32 
    33 
    34     int N;
    35     fin >> N;
    36 
    37     for (int i = 0; i < N; i++){
    38         User user;
    39         fin >> user.name >> user.passwd;
    40         users.push_back(user);
    41     }
    42 
    43     int mod_cnt = 0;
    44     for (int i = 0; i < N; i++){
    45         User &user = users[i];
    46         string &str = user.passwd;
    47         for (int j = 0; j < str.size(); j++){
    48             bool modified = true;
    49             if (str[j] == '1')
    50                 str[j] = '@';
    51             else if (str[j] == '0')
    52                 str[j] = '%';
    53             else if (str[j] == 'l')
    54                 str[j] = 'L';
    55             else if (str[j] == 'O')
    56                 str[j] = 'o';
    57             else
    58                 modified = false;
    59 
    60             user.modified |= modified;
    61         }
    62         if (user.modified)
    63             mod_cnt++;
    64     }
    65 
    66     if (mod_cnt == 0){
    67         cout << "There " << (N == 1 ? "is " : "are ") << N << (N == 1 ? " account" : " accounts") << " and no account is modified" << endl;
    68 
    69         return 0;
    70     }
    71 
    72     cout << mod_cnt << endl;
    73     for (int i = 0; i < N; i++){
    74         User &user = users[i];
    75         if (user.modified){
    76             cout << user.name << " " << user.passwd << endl;
    77         }
    78     }
    79 
    80     return 0;
    81 }
  • 相关阅读:
    Qt第一个小程序(使用vs2017开发)
    Qt资料大全
    Win10+MSVC2017+QT5.9.4开发环境
    小波去噪的基本知识
    RxJava Map操作详解
    Tomcat提示Null component
    章节目录
    BeanDefinition的载入和解析
    org.springframework.util.Assert
    使用Eclipse maven构建springmvc项目
  • 原文地址:https://www.cnblogs.com/EpisodeXI/p/4095911.html
Copyright © 2011-2022 走看看