1 条题解

  • 0
    @ 2025-4-12 21:41:02

    C :

    #include<stdio.h>
    #include<string.h>
    int main()
    {
    	char s1[100],s2[100];
    	int i,l;
    	scanf("%s",s1);
    	l=strlen(s1);
    	for(i=0;i<l;i++)
    	{
    		if((s1[i]>='a'&&s1[i]<'w')||(s1[i]>='A'&&s1[i]<'W'))
    		{
    			s1[i]=s1[i]+4;
    		}
    		else s1[i]=s1[i]-22;
    	}
    	printf("%s\n",s1);
    }
    
    

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<iostream>
    
    using namespace std;
    
    int main(){
        string str;
        while(cin>>str){
            for(int i=0;i<str.length();i++)
                if(str[i]>='W'&&str[i]<='Z'||str[i]>='w'&&str[i]<='z')
                    printf("%c",str[i]-22);
                else
                    printf("%c",str[i]+4);
            cout<<endl;
        }
        return 0;
    }
    
    
    • 1

    信息

    ID
    1104
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者