zoj 1006 Do the Untwist

zoj 1006 Do the Untwist,第1张

zoj 1006 Do the Untwist
#include<stdio.h>#include<string.h>char  plainText[70],cipherText[70];int plainCode[70],cipherCode[70];int k,len;int main(){   int i;   while(1)   {      scanf("%d",&k);      if(k==0)      {          break;       }       scanf("%s",cipherText);      len=strlen(cipherText);      for(i=0;i<len;i++)      {         if(cipherText[i]>='a'&&cipherText[i]<='z')         {  cipherCode[i]=cipherText[i]-'a'+1;          }          else if(cipherText[i]=='_')         {  cipherCode[i]=0;         }         else if(cipherText[i]=='.')         {  cipherCode[i]=27;         }      }      for(i=0;i<len;i++)      {         plainCode[(i*k)%len]=(cipherCode[i]+i)%28;       }      for(i=0;i<len;i++)      {         if(plainCode[i]>=1&&plainCode[i]<=26)         { plainText[i]='a'-1+plainCode[i];          }          else if(plainCode[i]==0)         { plainText[i]='_';          }         else if(plainCode[i]==27)         { plainText[i]='.';          }      }      for(i=0;i<len;i++)      {         printf("%c",plainText[i]);       }      printf("n");   }   return 0; }

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4923014.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存