P1079 Vigenère 密码解题报告

无秒

2020-05-13 19:01:37

Personal

这题,额,很水…… 一个字符串的操作就行,嗯,具体看下代码就能懂。 ```cpp #include<cstdio> #include<iostream> #include<cmath> using namespace std; int f(char x) { if(x>=65&&x<=90) return x-65; return x-97; } int main() { int t; string a,b; cin>>a>>b; for(int i=0;i<b.length();i++) { t=f(a[i%a.length()]); b[i]=f(b[i])-t+1>0?b[i]-t:b[i]-t+26; } cout<<b; return 0; } ```