zoukankan      html  css  js  c++  java
  • UVA12897

    没必要每次都真的修改一遍字母值,用一个标记表示字母最后的值,最后一遍的时候再进行修改

    #include<cstdio>
    #include<cstring>
    
    const int maxlen = 1000000+10;
    
    char str[maxlen];
    
    
    char to[256];
    
    int main()
    {
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
        int T;
        scanf("%d",&T);
        to['_'] = '_';
        while(T--){
            scanf("%s",str);
            int e;
            scanf("%d
    ",&e);
            for(int i = 'A'; i <= 'Z'; i++) to[i] = i;
            for(int j = 0; j < e; j++){
                int v,u;
                char buf[10];
    
                fgets(buf,9,stdin);
                int i = 0;
                for(;i<9;i++) if('A'<=buf[i]&&buf[i]<='Z'){
                    v = buf[i++]; break;
                }
    
                for(;i<9;i++) if('A'<=buf[i]&&buf[i]<='Z'){
                    u = buf[i++] ; break;
                }
                for(int i = 'A'; i <= 'Z';i++){
                    if(u == to[i])
                        to[i] = v;
                }
            }
            int len = strlen(str);
            for(int i = 0; i < len; i++){
                str[i] = to[str[i]];
            }
            printf("%s
    ",str);
        }
        return 0;
    }
  • 相关阅读:
    数据库默认隔离级别
    openldap安装
    new word
    ldap概念
    Oracle 计算函数
    informix 学习资料收集
    convert to groovy project
    ldap资料
    hibernate session
    IE BUG相关文章集合
  • 原文地址:https://www.cnblogs.com/jerryRey/p/4652486.html
Copyright © 2011-2022 走看看