zoukankan      html  css  js  c++  java
  • Codeforces

    https://codeforc.es/gym/102222/my
    好像在哪里见过这个东西?字符的左右移还是小心,注意在mod26范围内。

    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    
    inline int read() {
        int x=0;
        int f=0;
        char c;
        do {
            c=getchar();
            if(c=='-')
                f=1;
        } while(c<'0'||c>'9');
        do {
            x=(x<<3)+(x<<1)+c-'0';
            c=getchar();
        } while(c>='0'&&c<='9');
        return f?-x:x;
    }
    
    inline void _write(int x) {
        if(x>9)
            _write(x/10);
        putchar(x%10+'0');
    }
    
    inline void write(int x) {
        if(x<0) {
            putchar('-');
            x=-x;
        }
        _write(x);
        putchar('
    ');
    }
    
    void TestCase(int ti);
    
    int main() {
    #ifdef Yinku
        freopen("Yinku.in","r",stdin);
        //freopen("Yinku.out","w",stdout);
    #endif // Yinku
        int T=read();
        for(int ti=1;ti<=T;ti++)
            TestCase(ti);
    }
    
    /*---  ---*/
    
    char p[60],c[60],p2[60],c2[60];
    char t[256];
    
    void TestCase(int ti) {
        int n=read(),m=read();
        scanf("%s%s%s",p,c,c2);
        int rightshift=c[0]-p[0];
        if(rightshift<0)
            rightshift+=26;
        for(int i=0;i<m;i++){
            p2[i]=c2[i]-rightshift;
            if(p2[i]<'A')
                p2[i]+=26;
        }
        p2[m]='';
        printf("Case #%d: ",ti);
        puts(p2);
    }
    
  • 相关阅读:
    申请加分项
    课程评价
    本周总结
    热词2
    热词1
    php大作业
    css网格布局
    php实验4
    本周总结
    css边框图像
  • 原文地址:https://www.cnblogs.com/Yinku/p/11037534.html
Copyright © 2011-2022 走看看