3 条题解
-
1lichengjun LV 10 @ 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; }
-
12023-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; }
-
02024-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
- 标签
- 递交数
- 182
- 已通过
- 62
- 上传者