占领空地。
2026-09-04 19:44:07
发布于:江苏
6阅读
0回复
0点赞
我也看不懂我在干什么
洛谷:原题
#include <bits/stdc++.h>
using namespace std;
string x,y,z;
int c[30],s = 0;
bool f[30],t[30];
int main()
{
memset(c,0,sizeof(c));
memset(f,0,sizeof(f));
memset(t,0,sizeof(t));
cin >> x >> y >> z;
for(int i = 0;i < x.size();i ++)
{
if(!f[x[i] - 'A' + 1] && !t[y[i] - 'A' + 1])
{
c[x[i] - 'A' + 1] = y[i];
f[x[i] - 'A' + 1] = t[y[i] - 'A' + 1] = 1;
++ s;
}
else if(c[x[i] - 'A' + 1] != y[i])
{
cout << "Failed";
return 0;
}
}
if(s != 26)
{
cout << "Failed";
return 0;
}
for(int i = 0;i < z.size();++ i)
{
printf("%c",c[z[i] - 'A' + 1]);
}
return 0;
}
有用请点个赞。




这里空空如也







有帮助,赞一个