本地运行好像可以,但测试就会RE

P1914 小书童——凯撒密码

ngmhhy @ 2023-09-20 14:18:51

#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    int c[60],n;
    scanf("%d",&n);
    cin>>a;
    for(int i=0;i<a.length();i++){
        c[i]=a[i]-'`';
        c[i]=c[i]+n%26;
        if(c[i]>26) c[i]=c[i]%26;
            //printf("%d\n",c[i]);
        b[i]=c[i]+'a'-1;
        printf("%c",b[i]);
    }
    }

by yzm0325 @ 2023-09-20 14:24:43

@ngmhhy 盲猜大小写需要判


|