题解 | 凯撒解密

凯撒解密

https://www.nowcoder.com/practice/42c2f0c1351e4a6689ff64eddaf97a37

#include<stdio.h>
 #include<string.h>
char* decodeWangzai(char* s, int n ) {
    
    scanf("%s %d",s,&n);
    int len =strlen(s);
    for(int i=0;i<len;i++)
    {
        int temp = s[i]-'a';
        temp=(temp-n)%26;
        
        if(temp>=0){
            s[i]='a'+temp;
        }
        else {
        s[i]='a'+temp+26;
        }

    }
    return s;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务