为什么60,求dalao解答

P1914 小书童——凯撒密码

Caelestium @ 2018-04-01 15:22:43

include<bits/stdc++.h>

using namespace std; char mima[51]; int wei; int main() { cin>>wei; cin>>mima; for(int n=0;n<strlen(mima);n++) { if(mima[n]+wei>122) { wei=mima[n]+wei-122; mima[n]='a'+wei; } else { mima[n]+=wei; } } for(int m=0;m<strlen(mima);m++) { printf("%c",mima[m]); } return 0; }


by Caelestium @ 2018-04-01 15:31:30

会用代码框了,再发一个

#include<bits/stdc++.h>
using namespace std;
char mima[51];
int wei;
int main()
{
    cin>>wei;
    cin>>mima;
    for(int n=0;n<strlen(mima);n++)
    {
        if(mima[n]+wei>122)
        {
            wei=mima[n]+wei-122;
            mima[n]='a'+wei;
        }
        else
        {
            mima[n]+=wei;
        }
    }
    for(int m=0;m<strlen(mima);m++)
    {
        printf("%c",mima[m]);
    }
    return 0;
}

by dying @ 2018-04-24 16:57:37

me too

#include<bits/stdc++.h>
char qq[60];
int main(){
    int n;scanf("%d%s",&n,qq);
    for(int i=0;i<strlen(qq);i++){
        qq[i]+=n;if(qq[i]>'z')qq[i]-=26;
        }
        puts(qq);
        return 0;
}

by Aether_2020 @ 2018-05-21 21:09:41

此题题解(我写的)


by Shui_Dream @ 2018-06-08 14:34:31

include<bits/stdc++.h>

using namespace std;
int n,x;
string a;
int main()
{ cin>>n;
cin>>a;
for(int i=0;i<=a.size();i++)
{
x=0;
if(char(a[i])+n<='z') a[i]=char(char(a[i])+n);
if(char(a[i])+n>'z')
{
x='z'-char(a[i]);
a[i]=char('a'+x);
}
}
cout<<a;

return 0;

}


by Shui_Dream @ 2018-06-08 14:35:59

include<bits/stdc++.h>

using namespace std;
int n,x;
string a;
int main()
{
cin>>n;
cin>>a;
for(int i=0;i<=a.size();i++)
{
x=0;
if(char(a[i])+n<='z') a[i]=char(char(a[i])+n);
if(char(a[i])+n>'z')
{
x='z'-char(a[i]);
a[i]=char('a'+x);
}
}
cout<<a;

return 0; }


by 天美亲生爸爸 @ 2018-06-11 19:46:34

80分 求帅哥美女教@_@


by 天美亲生爸爸 @ 2018-06-11 19:46:49

include <iostream>

using namespace std; int main(){ string s; int l,i,n; cin>>n>>s; l=s.length(); for (i=0;i<l;i++){ if (n>=26&&s[i]>'e') n=n%26; s[i]=s[i]+n; if (s[i]>'z') s[i]=s[i]-26; } cout<<s; return 0; }


by 天美亲生爸爸 @ 2018-06-11 19:47:23

include <iostream>

using namespace std; int main(){ string s; int l,i,n; cin>>n>>s; l=s.length(); for (i=0;i<l;i++){ if (n>=26&&s[i]>'e') n=n%26; s[i]=s[i]+n; if (s[i]>'z') s[i]=s[i]-26; } cout<<s; return 0; }1.- 1.- ```cpp

include <iostream>

using namespace std; int main(){ string s; int l,i,n; cin>>n>>s; l=s.length(); for (i=0;i<l;i++){ if (n>=26&&s[i]>'e') n=n%26; s[i]=s[i]+n; if (s[i]>'z') s[i]=s[i]-26; } cout<<s; return 0; }


|