6 条题解

  • 2
    @ 2023-1-4 15:35:55
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	cout.tie(0);
        int n;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            string str;
            cin>>str;
            if(str[0]>='a'&&str[0]<='z')
            {
                str[0]-=32;
                for(int j=1;j<str.size();j++)
                {
                    if(str[j]>='A'&&str[j]<='Z')
                        str[j]+=32;
                }
                cout<<str<<endl;
            }
            else if(str[0]>='A'&&str[0]<='Z')
            {
                for(int j=1;j<str.size();j++)
                {
                    if(str[j]>='A'&&str[j]<='Z')
                        str[j]+=32;
                }
                cout<<str<<endl;
            }
            else
            {
                for(int j=1;j<str.size();j++)
                {
                    if(str[j]>='A'&&str[j]<='Z')
                        str[j]+=32;
                }
                cout<<str<<endl;
            }
        }
        return 0;
    }
    
    • 1
      @ 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;
      }
      
      • 0
        @ 2025-3-26 19:38:09

        #include<bits/stdc++.h> using namespace std; char s[10000]; int main() {

        int n;
        cin >>n; 
        while(n--)
        {
        	cin>>s;
        	if(s[0]>='a' && s[0]<='z') 
        		s[0]-=32;
        	for(int i=1;i<strlen(s);i++)
        		if(s[i]>='A' && s[i]<='Z')  
        			s[i]+=32;
        	cout<<s<<endl;		
        }
        return 0;
        

        }

        • 0
          @ 2025-3-26 19:37:58

          #include<bits/stdc++.h> using namespace std; char s[10000]; int main() {

          int n;
          cin >>n; 
          while(n--)
          {
          	cin>>s;
          	if(s[0]>='a' && s[0]<='z') 
          		s[0]-=32;
          	for(int i=1;i<strlen(s);i++)
          		if(s[i]>='A' && s[i]<='Z')  
          			s[i]+=32;
          	cout<<s<<endl;		
          }
          return 0;
          

          }

          • 0
            @ 2025-3-23 20:48:02

            #include <bits/stdc++.h> using namespace std; string s; int n; int main(){ getline(cin, s); for (int i = 1; i <= n; i++){ cin >> s; if (s[0] >= 'a' && s[0] <= 'z'){ s[0] -= 32; } else if (s[i] >= 'A' && s[i] <= 'Z'){ s[i] += 32; } cout << s << endl; } return 0; } //错误的题解!!!😂

            • 0
              @ 2024-8-1 9:22:25
              #include<bits/stdc++.h>
              using namespace std;
              int main()
              {
              	char a[21];
              	int n;
              	cin >>n; 
              	while(n--){
              		cin>>a;
              		int len=strlen(a); 
              		if(a[0]>='a' && a[0]<='z') a[0]-=32;
              			for(int i=1;i<len;i++)
              				if(a[i]>='A' && a[i]<='Z')  a[i]+=32;
              		cout<<a<<endl;		
              	}
              	return 0;
              }
              
              • 1

              信息

              ID
              1154
              时间
              1000ms
              内存
              128MiB
              难度
              6
              标签
              递交数
              288
              已通过
              83
              上传者