hdu-1129(模拟题)

时间:2022-11-06 16:13:19

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1129

注意:c_code[i]=(p_code[i*k%n]-i)%28;

#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
using namespace std;
char dc[]={'_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
'u','v','w','x','y','z','.'};
map <char,int> mp;
char str[];
int pcode[],ccode[];
int main(void)
{
mp['_']=;mp['a']=;mp['b']=;mp['c']=;mp['d']=;mp['e']=;mp['f']=;mp['g']=;mp['h']=;mp['i']=;
mp['j']=;mp['k']=;mp['l']=;mp['m']=;mp['n']=;mp['o']=;mp['p']=;mp['q']=;mp['r']=;
mp['s']=;mp['t']=;mp['u']=;mp['v']=;mp['w']=;mp['x']=;mp['y']=;mp['z']=;mp['.']=;
int n,len,i,j,k;
while(~scanf("%d",&k)&&k)
{
scanf("%s",str);
len=strlen(str);
for(i=;i<len;i++)
{
ccode[i]=mp[str[i]];
pcode[i*k%len]=(ccode[i]+i)%;
}
for(i=;i<len;i++) printf("%c",dc[pcode[i]]);
printf("\n");
}
return ;
}