题目1134:密码翻译

来源:互联网 发布:爱因斯坦 以色列 知乎 编辑:程序博客网 时间:2024/05/17 03:53

#include <string.h>  #include <stdlib.h>  #include <stdio.h>  //using namespace std;  int main()  {      int n,i,j,k;      char str[100];      while (scanf("%d\n",&n)!=EOF)      {          for (i=0;i<n;i++)          {              gets(str);              for (j=0;j<strlen(str);j++)              {                  if ((str[j]>='a'&&str[j]<='y')||(str[j]>='A'&&str[j]<='Z'))                  {                      str[j]=str[j]+1;                  }                  else if (str[j]=='Z'||str[j]=='z')                  {                      str[j]=str[j]-25;                  }              }              puts(str);          }      }      return 1;  } /**************************************************************    Problem: 1134    User: cust123    Language: C++    Result: Accepted    Time:0 ms    Memory:1020 kb****************************************************************/


0 0
原创粉丝点击