当前位置: 首页 > 编程日记 > 正文

Codeforces Round #300 A. Cutting Banner 水题

A. Cutting Banner

Time Limit: 1 Sec  Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/538/problem/A

Description

A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforcesω that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that contains someone else's word. The word on the banner consists only of upper-case English letters.

There is very little time to correct the mistake. All that we can manage to do is to cut out some substring from the banner, i.e. several consecutive letters. After that all the resulting parts of the banner will be glued into a single piece (if the beginning or the end of the original banner was cut out, only one part remains); it is not allowed change the relative order of parts of the banner (i.e. after a substring is cut, several first and last letters are left, it is allowed only to glue the last letters to the right of the first letters). Thus, for example, for example, you can cut a substring out from string 'TEMPLATE' and get string 'TEMPLE' (if you cut out string AT), 'PLATE' (if you cut out TEM), 'T' (if you cut out EMPLATE), etc.

Help the organizers of the round determine whether it is possible to cut out of the banner some substring in such a way that the remaining parts formed word CODEFORCES.

Input

The single line of the input contains the word written on the banner. The word only consists of upper-case English letters. The word is non-empty and its length doesn't exceed 100 characters. It is guaranteed that the word isn't word CODEFORCES.

Output

Print 'YES', if there exists a way to cut out the substring, and 'NO' otherwise (without the quotes).

Sample Input

CODEWAITFORITFORCES

Sample Output

YES

HINT

题意

给你一个字符串,然后让你删除一段字符,看是否能构成CODEFORCES

题解:

啊,枚举区间就好了……

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
int Num;
char CH[20];
//const int inf=0x7fffffff;   //нчоч╢С
const int inf=0x3f3f3f3f;
/*inline void P(int x)
{Num=0;if(!x){putchar('0');puts("");return;}while(x>0)CH[++Num]=x%10,x/=10;while(Num)putchar(CH[Num--]+48);puts("");
}
*/
inline ll read()
{int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;
}
inline void P(int x)
{Num=0;if(!x){putchar('0');puts("");return;}while(x>0)CH[++Num]=x%10,x/=10;while(Num)putchar(CH[Num--]+48);puts("");
}
//**************************************************************************************string s;
int a[maxn];
string kiss="CODEFORCES";
int main()
{cin>>s;for(int i=0;i<s.size();i++){for(int j=i+1;j<=s.size();j++){string p=s.substr(0,i)+s.substr(j);//cout<<p<<endl;if(p=="CODEFORCES"){cout<<"YES"<<endl;return 0;}}}cout<<"NO"<<endl;
}

转载于:https://www.cnblogs.com/qscqesze/p/4458882.html

相关文章:

ImportError:cannot import name ‘display‘ File “XX“, line 5, in <module> from IPython import display

导入错误问题的一个解决思路是&#xff0c;推断这是模块间版本不兼容带来的问题&#xff0c;先把模块卸载掉&#xff0c;再用conda install安装上。也就是让conda去协调模块间兼容性。

[高级]android应用开发之intent的妙用二

相信做android应用开发的朋友对intent组件都已经是相当熟悉了&#xff0c;这里鄙人总结一下intent的妙用&#xff0c;希望对大家有帮助。 intent妙用之列出所有已安装的应用程序列表 装载&#xff1a;http://blog.csdn.net/android_tutor/article/details/5724634 这篇文章写的…

windows 自动化目录大纲(各企业架构不一样,按需选择)

有需要做自动化的联系979122932,一起交流学习转载于:https://blog.51cto.com/7763608/2338668

Java设计模式之虚拟代理模式

描述&#xff1a;虚拟代理模式(Virtual Proxy)是一种节省内存的技术&#xff0c;它建议创建那些占用大量内存或处理复杂的对象时&#xff0c;把创建这类对象推迟到使用它的时候。在特定的应用中&#xff0c;不同部分的功能由不同的对象组成&#xff0c;应用启动的时候&#xff…

(已解决)ImportError attempted relative import with no known parent package

想要调用同一目录下的另一个py文件中的类&#xff0c;以下或许是可行的解决方案。 需要做到两点 1. 将主调文件的名称改为__init__.py 2. from 被调文件的文件名称(删去末尾.py) import 类名 不要在被调文件的文件名称前面加点&#xff01; 我的目录结构 我的调用方式 fro…

小红点功能控件

写在前面 本意是想把做过的东西沉淀一下&#xff0c;防止重复造轮子。后来想想自己在实现这个的过程中还是走了一点弯路的。虽然网上找的轮子很多&#xff0c;其实大多都华而不实或者功能太多&#xff0c;工作中实现的东西最重要的不是功能炫&#xff0c;而是稳定&#xff0c;一…

根据条件查找数组中的一条数据并放入缓存

protected MemberInfo GetCacheMemberInfo(string userName) { MemberInfo minfo new MemberInfo();//实体 minfo System.Web.HttpRuntime.Cache.Get("HotPP_" userName) as MemberInfo;//读缓存 if (minfo null) { M…

看我如何下载韩寒博客文章笔记

str()将整型数据转化为字符型数据转载于:https://www.cnblogs.com/sunshinewxz/p/4461432.html

怎样知道pip install 可以安装包的哪些版本

方法一&#xff1a; 思路很清晰&#xff0c;故意不给版本号&#xff0c;然后系统就告诉你&#xff0c;这样不行呀&#xff0c;可以用以下XX,XX,XX版本号 例如安装torchtext

异步编程之Promise(2):探究原理

异步编程系列教程&#xff1a; (翻译)异步编程之Promise(1)——初见魅力异步编程之Promise(2)&#xff1a;探究原理异步编程之Promise(3)&#xff1a;拓展进阶异步编程之Generator(1)——领略魅力异步编程之Generator(2)——剖析特性异步编程之co——源码分析动手实现Promise 在…

PC端、移动端手机竖拍原图压缩上传顺时针旋转90°的解决方案

问题背景 最近在做的项目中&#xff0c;不管是移动端还是后台系统都涉及到了手机照片压缩上传的问题&#xff0c;做完功能测试的时候发现图片回显的时候有些顺时针旋转了90&#xff08;竖拍照片&#xff0c;不管是ios还是android都存在这问题&#xff09;&#xff0c;后来百度了…

perl:cpanm安装方式的一种取代方法

笔者现在有一个cpanfile&#xff0c;里面需要安装的perl模块&#xff0c;github的作者给出的指令是 cpanm --installdeps . 而笔者的服务器没有cpanm&#xff0c;因为不是管理员也无法用apt安装 经过一番搜索&#xff0c;发现以下的替代方式&#xff1a; 依次在命令行输入 1…

elementUI源码修改的爬坑之旅

今天由于项目需要&#xff0c;想在Tree组件的前面增加一个icon图标&#xff0c;根据不同类型增加不同的图标&#xff0c;我修改了elementUI的源代码&#xff0c;发布到npm上去成功使用&#xff0c;记录下过程中所碰到的问题&#xff0c;首先看下最后的效果&#xff1a; 下面简单…

Sublime text3 快捷方式(windows平台)

1.Goto Anything-快速查找&#xff08;ctrl P&#xff09; 输入函数名可以快速找到函数输入#文本可以快速进行文件内文本匹配2.命令模式CtrlShiftP&#xff1a;打开命令面板 CtrlP&#xff1a;搜索项目中的文件 CtrlW&#xff1a;关闭当前打开文件 CtrlShiftW&#xf…

(已解决)ubuntu20.04 jar xvf XXX.zip报错-java.io.EOFException:Unexpected end of ZLIB input stream

报错截图 如下 我在服务器上解压缩defects4j-repos.zip&#xff0c;但是出现了如上错误。通过SFTP我把这个压缩包传到了本地win10上面&#xff0c;进行解压缩。本地解压缩软件(有图形界面的好处显现了)告诉我这个文件已经损坏。 原因分析 由于运行脚本涉及到一堆的文件下载&am…

Linux上传和下载

下载&#xff1a;sz 上传&#xff1a;rz

joomla网页无任何显示输出

joomla配置环境&#xff1a;LAMP 先打开php.ini display_errorsOn 网页显示报错 Class DOMDocument not found *********** 解决方法&#xff1a; 1.安装php-xml #yum install php-xml 2.重启apache&#xff08;CentOS&#xff09; #service httpd restart转载于:https://www…

【mysql的编程专题⑤】自定义函数

用户自定义函数(user-defined function,UDF) 是一种对mysql的扩展途径&#xff0c;其用法与内置函数相同 创建自定义函数 语法 create function function_name returns {string|integer|real|decimal} routine_body Example1 delimiter $ create function f1(gdate datetime) …

配深度学习环境要注意的不多,也就

1. 使用nvcc -V命令查看cuda版本&#xff0c;再在官网选择对应版本的pytorch。(是的不要根据python的版本去选择pytorch指令) 2. 用conda安装pytorch可能一直有cpuonly的玄学问题。(哪怕选择的是CUDA版本的pytorch安装命令)改用pip安装。 3. torchtext不会被顺带安装&#xf…

整理的一点MD5资料(第一部分)

MD5加密算法研究MD5简介&#xff1a; MD5的全称是Message-Digest Algorithm 5&#xff0c;在90年代初由MIT的计算机科学实验室和RSA Data Security Inc发明&#xff0c;经MD2、MD3和MD4发展而来。 Message-Digest泛指字节串(Message)的Hash变换&#xff0c;就是把一个任意长度的…

SQL学习(六)

1. INSERT 通用形式&#xff1a; INSERT INTO tablename [colname {,colname...}] {VALUES (expr &#xff5c;NULL &#xff5c; Subquery)} 例&#xff1a;1. insert into orders (ordno,month) values (1107.aug); 2. insert into swcusts select * from customers wh…

百练,4103,踩方格

百练&#xff0c;4103&#xff0c;踩方格 普通做法&#xff1a;&#xff08;也可以找规律&#xff09; #include #include//要调用memset函数&#xff0c;头文件 using namespace std; int visited[50][50];//开辟50*50的方格 int num0;//num为方案数 void ways(int i,int j,i…

BZOJ1747 [Usaco2005 open]Expedition 探险

首先我们可以发现如果错过了一个加油站&#xff0c;而继续往前走的时候没有油了&#xff0c;可以再假装之前经过加油站的时候加过油 于是我们维护一个大根堆&#xff0c;表示错过的加油站是哪些&#xff0c;每当没有油的时候从堆顶取出最大值加上去即可 1 /*******************…

Netty - ByteBuf索引管理

2019独角兽企业重金招聘Python工程师标准>>> 之前写过一篇文章介绍过JDK里面InputStream的mark(readlimit)和reset()方法&#xff0c;Java IO&#xff1a;使用mark/reset实现替换文件中字符串。相应的&#xff0c;可以通过调用markReaderIndex()/markWriterIndex()/…

DB2 9 利用开辟(733 测验)认证指南,第 1 部分: 数据库工具与编程步调(6)

运用基泉源基本理构建根本完毕语总结本教程向您引见了 DB2 利用挨次开辟的根本常识。在中缀任何开辟变乱之前&#xff0c;必须熟习差别规范的数据库工具。在本教程中&#xff0c;引见了几种初级的数据库工具。别名、序列工具和且则表凡是用于简化利用挨次代码。存储历程、函数和…

PHP 设计模式 笔记与总结(9)数据对象映射模式

【数据对象映射模式】 是将对象和数据存储映射起来&#xff0c;对一个对象的操作会映射为对数据存储的操作。例如在代码中 new 一个对象&#xff0c;使用数据对象映射模式就可以将对象的一些操作比如设置一些属性&#xff0c;就会自动保存到数据库&#xff0c;跟数据库中表的一…

inet_pton和inet_ntop函数

Linux下这2个IP地址转换函数&#xff0c;可以在将IP地址在“点分十进制”和“整数”之间转换 而且&#xff0c;inet_pton和inet_ntop这2个函数能够处理ipv4和ipv6。算是比较新的函数了。 inet_pton函数原型如下[将“点分十进制” &#xff0d;> “整数”] #include <sys/…

Firefox3 RC1颁布各种新特征发扬阐发更平定

作者: Dailon 出自: http://www.linuxdiyf.com Mozilla项目曾经颁布了Firefox 3 RC1。Firefox 3的新特征包罗对Javascript 1.8的支持、DOM和HTML的转变、微技俩&#xff08;microformats&#xff09;支持及一个扩展的Canvass完成。 Mozilla公司颠末对Javascript 1.8特征…

java中判断两个字符(或者字符串相等)

string a,b;//两字符串 在java中判断两个字符&#xff08;字符串&#xff09;相等&#xff0c;用a.equals(b); if(a.equals(b)){ //如果相等&#xff0c;返回值为true }else{ //如果不相等&#xff0c;返回值为false } 不能用if(ab)来进行判断,这里比较的是两数据的内存

初学Hadoop之图解MapReduce与WordCount示例分析

Hadoop的框架最核心的设计就是&#xff1a;HDFS和MapReduce。HDFS为海量的数据提供了存储&#xff0c;MapReduce则为海量的数据提供了计算。HDFS是Google File System&#xff08;GFS&#xff09;的开源实现&#xff0c;MapReduce是Google MapReduce的开源实现。HDFS和MapReduc…