P10125 「Daily OI Round 3」Simple题解

原题传送门

题目概述:

给我们一个字符串,不区分大小写,让我们判断此字符串是与 Acoipp 等价,还是与 Svpoll 等价,或者是与前两者都不等价,并按题目条件输出。

思路分析:

我们只需要把此字符串的第一个字符转成大写,其他字符转成小写,并与那两个字符串进行比较就行了

代码:

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str,s;
    cin>>str;
    if(str[0]>='a'&&str[0]<='z')
    {
        s += str[0]-('a'-'A');
    }
    else s += str[0];
    for(int i=1;i<str.size();i++)
    {
        if(str[i]>='A'&&str[i]<='Z')
        {
            s += str[i]+('a'-'A');
        }
        else s += str[i];
    }
    if(s=="Acoipp")
    {
        cout<<"Luogu";
    }
    else if(s=="Svpoll")
    {
        cout<<"Genshin";
    }
    else cout<<"Boring";
    return 0;
}
 
posted @ 2024-02-07 09:14  shixuanbin  阅读(44)  评论(0)    收藏  举报