0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

P1079 Vigenère 密码

R41008851
This commit is contained in:
Baoshuo Ren 2020-11-01 15:54:30 +08:00 committed by Baoshuo Ren
parent 5bbc2ca861
commit 19922acd32
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

20
problem/P1079/P1079.cpp Normal file
View File

@ -0,0 +1,20 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
string k, c;
int t = 0;
cin >> k >> c;
for (int i = 0; i < c.size(); i++) {
t = (k[i % k.size()] & 31) - 1;
if((c[i] & 31) - t > 0) {
c[i] = c[i] - t;
}
else {
c[i] = c[i] - t + 26;
}
}
cout << c << endl;
return 0;
}