水题 Codeforces Round #300 A Cutting Banner

时间:2023-03-08 23:25:20
水题 Codeforces Round #300 A Cutting Banner

题目传送门

 /*
水题:一开始看错题意,以为是任意切割,DFS来做;结果只是在中间切出一段来
判断是否余下的是 "CODEFORCES" :)
*/
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f;
string s, tar = "CODEFORCES"; int main(void) //Codeforces Round #300 A Cutting Banner
{
//freopen ("A.in", "r", stdin); while (cin >> s)
{
int len_1 = s.length ();
int len_2 = tar.length (); if (len_1 < ) puts ("NO");
else
{
int p = ;
for (; p<len_2; ++p)
{
if (s[p] != tar[p]) break;
}
for (; p<len_2; ++p)
{
if (s[p+len_1-len_2] != tar[p]) break;
} if (p == len_2) puts ("YES");
else puts ("NO");
}
} return ;
} /*
YES
NO
*/