水题 Codeforces Round #300 A Cutting Banner
1 /*
2 水题:一开始看错题意,以为是任意切割,DFS来做;结果只是在中间切出一段来
3 判断是否余下的是 "CODEFORCES" :)
4 */
5 #include <cstdio>
6 #include <iostream>
7 #include <cstring>
8 #include <string>
9 #include <algorithm>
10 #include <cmath>
11 #include <set>
12 #include <map>
13 using namespace std;
14
15 const int MAXN = 1e4 + 10;
16 const int INF = 0x3f3f3f3f;
17 string s, tar = "CODEFORCES";
18
19 int main(void) //Codeforces Round #300 A Cutting Banner
20 {
21 //freopen ("A.in", "r", stdin);
22
23 while (cin >> s)
24 {
25 int len_1 = s.length ();
26 int len_2 = tar.length ();
27
28 if (len_1 < 10) puts ("NO");
29 else
30 {
31 int p = 0;
32 for (; p<len_2; ++p)
33 {
34 if (s[p] != tar[p]) break;
35 }
36 for (; p<len_2; ++p)
37 {
38 if (s[p+len_1-len_2] != tar[p]) break;
39 }
40
41 if (p == len_2) puts ("YES");
42 else puts ("NO");
43 }
44 }
45
46 return 0;
47 }
48
49 /*
50 YES
51 NO
52 */
编译人生,运行世界!