专栏文章
题解:P13593 [NWRRC 2023] Missing Vowels
P13593题解参与者 1已保存评论 0
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mioh54ac
- 此快照首次捕获于
- 2025/12/02 19:07 3 个月前
- 此快照最后确认于
- 2025/12/02 19:07 3 个月前
解析见注释。
CPP#include<bits/stdc++.h>
using namespace std;
string l_c(string t); // 将大写字母转化成小写字母
bool check(char c); // 判断一个字母是不是元音字母
string s,f;
int fl;
int main()
{
cin>>s>>f;
s=l_c(s),f=l_c(f);
fl=f.length();
for(int i=0,j=0;i<f.length();i++,j++) // 逐字校对短、全名
{
if(s[j]!=f[i]) // 如果该位置两名不相同
{
if(!check(f[i])) // 全名此处不为元音
{
cout<<"Different";
return 0;
}
j--,fl--; // 否则跳过(效果等同于删掉)该元音继续校对
}
if(s.length()>fl) // 如果短名比长名长
{
cout<<"Different";
return 0;
}
}
cout<<"Same";
return 0; // 管理大大求过qwq
}
string l_c(string t)
{
for(int i=0;i<t.length();i++)
if(t[i]>='A'&&t[i]<='Z')
t[i]+='a'-'A';
return t;
}
bool check(char c)
{
if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y')
return 1;
return 0;
}
相关推荐
评论
共 0 条评论,欢迎与作者交流。
正在加载评论...