RocksonLee's Blog
avatar
RocksonLee
2022-03-16 19:29:33

Problem

luogu

codeforces

Solution

你仔细想一下,他一次只能删除两个字母,还要剩下一个字母是它指定的

那么在一个串中,这个字母只能在 s[2*i+1] ( 2*i+1 \in n ) (数组从1开始)这个位置上,这样前面的字母刚好够删去,自然,后面的字母数也就是偶数

Code

#include <bits/stdc++.h>
using namespace std;

#define il inline
#define INF 0x3f3f3f3f
#define cl(a, b) memset(a, b, sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
int x;
bool flag;
char temp[100], temp2[100];
int main()
{
    scanf("%d", &x);
    for (int i = 0; i < x; i++)
    {
        scanf("%s", temp);
        scanf("%s", temp2);
        int len = strlen(temp);
        flag = false;
        for (int i = 0; i < len; i += 2)
            if (temp[i] == temp2[0])
            {
                flag = true;
                break;
            }
        if (flag)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}
CF 1650A Deletions of Two Adjacent Letters
comment评论
Search
search