咋60分呢?

P1914 小书童——凯撒密码

fakeblue @ 2019-11-04 21:21:55

include<bits/stdc++.h>

using namespace std;

int main() {

int a;

cin>>a;

string b;

cin>>b;

char t[sizeof(b)];

for(int y=0;y<b.size();y++)

t[y]=b[y];

for(int y=0;y<b.size();y++)

{

t[y]+=a;

if(t[y]>'z')

t[y]+='a'-'z'-1;

cout<<t[y];

} return 0;

}


by fakeblue @ 2019-11-04 21:22:42

请求各大佬出手相助

第三第四个点WA了


by fakeblue @ 2019-11-04 21:25:20

来自一个蒟蒻无力的求救


by fakeblue @ 2019-11-04 21:48:20

似乎没有人回答我

伤心


by foxdemon @ 2019-11-04 22:07:57

@Dliso_Null

#include<bits/stdc++.h>
using namespace std;
int n ;
string s ;
int main()
{
    int i = 0 ;
    cin >> n >> s ;
    for ( i = 0 ; i < s.length() ; i++ )
    {
        if ( s[i] + n > 122 )
        {
            s[i] = s[i] + n - 26 ;
        }
        else s[i] = s[i] + n ;
    }
    cout << s ;
    return 0 ;
} 

by fakeblue @ 2019-11-05 20:22:05

@foxdemon

谢谢!


|