只有60分,蒟蒻求救

P1914 小书童——凯撒密码

txr20050504 @ 2019-07-01 22:39:02

// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
char a[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','r','s','t','u','v','w','x','y','z','a','b','c','d','e','f','g','h','i','j','k'};
char s[100];
int main()
{
    int n;
    cin>>n>>s;
    for(int i=0;i<strlen(s);++i){
        if(s[i]>='a'&&s[i]<='z'){
            for(int j=0;j<=26;++j){
                if(s[i]==a[j]){ cout<<a[j+n];break;}
            }
        }
        else cout<<s[i];
    }
}

by sunhaoqiang @ 2019-07-06 13:56:03

卑微的问一下,蒟蒻什么意思


by I_will @ 2019-07-14 08:37:35

弱弱的问一下:

#include<iostream>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
string a;
int n;
int main()
{
cin>>n>>a;
for(int i=0;i<a.size();i++)
{
    if(a[i]-'a'+1+n>26)a[i]=char((a[i]-'a'+1+n)%26+1+'a'-1);
    else a[i]=char(a[i]+n);

}
cout<<a;

return 0;
}

......

求大神帮助!

求收徒~QAQ


by I_will @ 2019-07-14 08:37:56

60分


上一页 |