我是靠谱客的博主 文艺过客,最近开发中收集的这篇文章主要介绍Codeforces - 102222C - Caesar Cipher,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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('n');
}
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);
}

转载于:https://www.cnblogs.com/Yinku/p/11037534.html

最后

以上就是文艺过客为你收集整理的Codeforces - 102222C - Caesar Cipher的全部内容,希望文章能够帮你解决Codeforces - 102222C - Caesar Cipher所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(60)

评论列表共有 0 条评论

立即
投稿
返回
顶部