#include "iostream"
#include "cmath"
#include "cstdio"
#include "string"
using namespace std;
int main()
{
int n, x, d, spos[300], i, lens, lenc, t, a, b;
string s, p, c;
char m[200];
while (cin >> n && n)
{
cin >> s >> p >> c;
lens = s.length();
for (i = 0;i < lens; i++)
spos[s[i]] = i;
lenc = c.length();
d = (int(pow(lenc, 1.5) + n)) % lenc;
m[d] = p[spos[c[d]]];
for (i = lenc + d - 1; i > d; i--)//主要是这个反编码的方法,如果你读懂了,这题模拟题就简单了!
{
t = i % lenc;
a = spos[c[t]];
b = spos[m[(t+1)%lenc]];
m[t] = p[a^b];
}
m[lenc] = '\0';
cout << m << endl;
}
system("pause");
}
poj 2015 Permutation Code
最新推荐文章于 2022-02-23 15:02:25 发布