6 条题解

  • 2
    @ 2023-4-5 10:05:08
    #include<iostream>
    using namespace std;
    int n;
    string a,b;
    bool check(char x){
    	if(('a'<=x&&x<='z')||('A'<=x&&x<='Z'))return true;
    	else return false;
    }
    int main(){
        cin>>n;
    	for(int i=1;i<=n;i++){
    		cin>>a;
    		for(int j=0;j<=a.size()-1;j++){
    			if(j==0&&check(a[j]))a[j]=toupper(a[j]);
    			else if(check(a[j]))a[j]=tolower(a[j]);
    		}
    		cout<<a<<endl;
    	}
    	return 0;
    }
    

    信息

    ID
    1154
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    递交数
    217
    已通过
    76
    上传者