2 条题解

  • 5
    @ 2023-7-14 11:22:14
    #include<stdio.h>
    #include <iostream>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    const int N=1e5+10;
    const int INF=0x3f3f3f3f;
    int n;
    string s;
    int main()
    {
    	cin>>n;
    	getline(cin,s);
    	for(int i=1;i<=n;i++)
    	{
    		getline(cin,s);
    		int len=s.size();
    		for(int j=0;j<len;j++)
    		{
    			if(s[j]>='A'&&s[j]<='Z')
    			{
    				s[j]+=32;
    				if(s[j]+i>'z')
    				    s[j]=s[j]+i-26;
    				else
    				s[j]+=i;
    			}
    			else if(s[j]>='a'&&s[j]<='z')
    			{
    				s[j]-=32;
    				if(s[j]+i>'Z')
    				     s[j]=s[j]+i-26;
    				     else
    				     s[j]+=i;
    			}
    		}
    		cout<<s<<endl;
    	}
    	return 0;
    }
    

    信息

    ID
    1929
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    699
    已通过
    118
    上传者