水题 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 */

 

转载于:https://www.cnblogs.com/Running-Time/p/4461052.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值