3 solutions

  • 1
    @ 2025-7-17 9:38:06
    #include<bits/stdc++.h>
    using namespace std;
    const int N=100001;
    char a[N];         //定义字符数组a 
    char b[N];
    int main()
    {
    	cin>>a;
    	int n=strlen(a);
    	for(int i=0;i<=n;i++)  //循环(遍历字符数组下标(默认从0开始)) 
    	{
    		b[i]=a[i]+a[i+1];
    		if(i==n-1)         //判断i是否等于最后一位 
    		{
    			b[i]=a[0]+a[i];
    		} 
    	}
    	cout<<b;
    	return 0;
    }
    

    Information

    ID
    917
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    65
    Accepted
    38
    Uploaded By