2 solutions

  • 6
    @ 2024-5-18 10:36:36
    #include<bits/stdc++.h>
    using namespace std;
    const int N=60;
    char s[N];
    int main()
    {
    	int n;
    	cin>>n;
    	cin>>s;
    	int m=strlen(s);
    	for(int i=0;i<m;i++)
    	{
    		int t=s[i]-'a'; //计算从'a'从走到当前字符需要几步 
    		t=t+n; //计算一共走的步数 
    		s[i]='a'+t%26; //计算去除周期以后得到的字符 
    	}
    	cout<<s;
    	return 0;
    }
    
  • -8
    @ 2024-5-25 11:24:34

    菜就多练

    • 1

    Information

    ID
    84
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    69
    Accepted
    28
    Uploaded By