codeforces 538 A.Cutting Banner

汇川机器人与PLC通信-ModbusTCP超详细案例 通过汇川机器人与PLC的ModbusTCP通信项目案例,我们可以了解通讯配置的过程,地址映射的方式,对接信号的转换,运行时序的逻辑等注意事项,帮助我们快速应用到项目中。 阅读详情

A. Cutting Banner
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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 outTEM), '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 test(s)
input
CODEWAITFORITFORCES
output
YES
input
BOTTOMCODER
output
NO
input
DECODEFORCES
output
YES
input
DOGEFORCES
output
NO


题目链接:http://codeforces.com/contest/538/problem/A


题目大意:给一个字符串,求切下一段后剩余部分是否等于“CODEFORCES”,能输出“YES”,不能输出"NO"。常见的字符串处理问题。用substr()函数处理即可。


代码如下:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main()
{
	int n,p=0;
	string a;
	cin>>a;
	n=a.length();
	for(int i=0;i<n;i++)
	{
		for(int len1=1;len1<n-i+1;len1++)
		{
			string b=a.substr(i,len1);//b为切后的前一段,c为切后的后一段
			for(int j=i+len1;j<n;j++)
			{
				for(int len2=1;len2<n-j+1;len2++)
				{
					string c=a.substr(j,len2);
					if(b+c=="CODEFORCES"&&(i==0&&j+len2==10||j+len2==n&&i==n-10||i==0&&j+len2==n))
					{//因为只能切掉一段,所以剩余两段连着在串首或者连着在串尾或者分别在两端
						p=1; 
						printf("YES\n");
						break;
					}
				}
				if(p)
					break;
			}
			if(p)break;
		}
		if(p)break;
	}
	if(!p)
		printf("NO\n");
	return 0;
}



扫地机器人:从仿真到决策,一个完整SLAM导航系统的自研之路 本文详细记录了从零开始自研扫地机器人SLAM导航系统的全过程,涵盖ROS-Gazebo仿真系统搭建、地图预处理优化、全覆盖规划算法迭代等关键技术。通过三次算法升级,最终实现92%的清洁效率,并分享DWA调参、状态机设计等实战经验,为开发者提供从仿真到落地的完整解决方案。 阅读详情

相关推荐

基于Openrouter的API调用免费大模型

Openrouter 是一个 AI 模型聚合平台,整合了全球 200 多种主流 AI 模型,包括 GPT-4、Claude、Gemini 等,以及国产通义千问、DeepSeek 等。其核心优势是统一的 API 设计,开发者仅需少量代码即可与多个模型交互,还支持自动路由与回退机制。用户可通过 OpenAI SDK 或 LangChain 调用 Openrouter 中的模型。

MurphyStar的博客 6199

Cutting_Banner(暴力)

传送门 题意:给你个字符串,减去一段子串,是否能将剩下的不改变顺序拼成"CODEFORCES",能则输出"YES",否则输出"NO" 思路:直接枚举减去的长度,然后暴力 代码如下 #include <algorithm> #include <cstdio> #include <cstring> #include <string> #include <vector> using namespace std; char aim[] = "COD

hao_6_6的博客 382

运放+三极管恒流源电路设计实战:从原理到仿真一步到位(附Multisim文件)

本文详细解析了运放与三极管构建恒流源电路的核心原理,重点阐述了负反馈机制如何实现精准的电流控制。通过Multisim仿真实战,从电路搭建、参数计算到负载调整率与动态响应分析,一步步指导设计过程,并提供常见故障的调试技巧与PCB设计要点,帮助工程师从理论平稳过渡到可靠实践。

7z8x2c4v6b9的博客 709

codeforces #300 A. Cutting Banner

题意: 给定一个字符串,找出能否找出【一个】【连续】的串,从串中删掉,然后剩下的串只剩下【CODEFORCES】。 是则输出YES,否则输出NO 思路: 穷举删除的区间,查看剩下的串是否是【CODEFORCES】即可。 我穷举的区间是[i,j) 区间(注意开闭符号), 对 【CODEFORCESXXXXXXX】这样的串先判定一下即可。 蓝桥杯要开始了,刷一波JAV

ACMer不要报考高校代码为13627的移通学院! 440

用Multisim仿真一个9V供电的双工对讲机:从电桥原理到LM1875功放调试全记录

本文详细介绍了使用Multisim仿真9V供电的双工对讲机全过程,涵盖电桥原理、NE5532前置放大设计、LM1875功放调试及双工通信实现。通过实战案例解析,帮助读者掌握模拟电路设计与调试技巧,提升电子工程实践能力。

weixin_28678831的博客 115

Ansys Zemax实战:5步搞定多模光纤耦合效率优化(附IMAE操作数详解)

本文详细介绍了使用Ansys Zemax优化多模光纤耦合效率的5个关键步骤,包括几何图像分析设置、IMAE操作数应用及偏振效应处理。通过实战案例解析,帮助工程师快速掌握光纤耦合效率提升技巧,特别针对IMAE操作数的配置保存机制和菲涅尔损耗控制进行深度讲解。

potato的博客 690

C - Cutting Banner

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...

qq_45147137的博客 336

【知识图谱】实践篇——基于知识图谱的《红楼梦》人物关系可视化及问答系统实践:part6基于图谱的问答实现

前序文章:本部分则是整个项目的核心内容——基于图谱的问答。需要实现的是对于“简单问题”进行解析,然后从图谱数据库中查询与该人员及其相关人员信息,返回到前端并显示该人员的基本信息。除此之外,用户可以点击返回的结果人员节点,页面能够显示该用户的个人基本信息。那么现在就开始吧。根据源码实现问答形式,其实是比较简单的。原代码中使用ltp对问题进行分词,选取具有名次词性的关键词进行处理。 ltp配置稍许麻烦,我使用jieba分词工具对问题进行分词,然后再按照原文提取问句中人物及关系,然后构建cypher neo4j查

让算法融入生活,改变生活! 2935

Cutting Banner

思路:没有思路。没有理解题意。不知道只剪一次,废了很多时间结果只需要分别从前边从后边比较。 代码: #include"cstdio" #include"algorithm" #include"set" #include"cmath" #include"cstring" using namespace std; int main() { char s[105]; char t[12]=“CODE...

cest123的博客 265

Python面试题及详细答案150道(126-135) -- 数据库交互篇

本文介绍了Python中操作MySQL、SQLite数据库及ORM框架的核心技术。主要内容包括:1. 使用pymysql连接MySQL数据库,演示了连接配置、SQL执行和事务管理;2. ORM原理及主流框架SQLAlchemy和Django ORM的示例;3. 通过sqlite3模块操作轻量级SQLite数据库;4. 数据库事务的ACID特性解析。这些内容涵盖了Python数据库开发的关键知识点,适合准备前后端面试的开发者复习核心概念和实际应用。

大剑师兰特的GIS世界 1727

4位无符号比较器设计

4位无符号比较器设计

好好学习,天天向上 7891

CodeForces 538 A.Cutting Banner(水~)

Description 切去一个字符串的某个子串后问剩余部分是否可能是CODEFORCES Input 一个字符串 Output 如果切去某个子串后可以变成CODEFORCES则输出YES,否则输出NO Sample Input DECODEFORCES Sample Output YES Solution 从字符串两端分别与目标串进行匹配直至不能匹配,记录匹配终点res1,...

ZSQ 553

MIPI D-PHY TX 一致性测试实例解析 Part 01

汽车电子领域,尤其是ADAS,伴随着摄像头的大规模布局,MIPI信号的使用日益频繁,关于它的验证与分析工作也变得日益关键

一只豌豆象的博客 1万+

Codeforces 538 A Cutting Banner

codeforces 538 A Cutting Banner 题目链接: Cutting Banner A. Cutting Banner time limit per test 2 seconds memory limit per test 256 megabytes input standard input

codedz的博客 423

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

codeforces 538 A Cutting Banner

A. Cutting Banner time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A large banner with word CODEFORCES was o

Han_kin的专栏 682

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

CodeForces - 538A Cutting Banner解题报告

题目大意:给你一个字符串,让你判断能否通过删除该字符串的一个子串,得到字符串 “CODEFORCES”。

薛崇祥的博客 546

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

C - Cutting Banner CodeForces - 538A

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...

云乐 315

A538: Cutting Banner

题目链接:http://codeforces.com/contest/538/problem/Aimport java.util.Scanner; public class A538 { void solve(){ Scanner in=new Scanner(System.in); String str=in.next(); String cf

水滴石穿 896

洛谷 CF538A Cutting Banner 题解

给定只由大写英文字母组成的字符串 s(长度不超过100),问删掉几个连续的字符(即删去一个子串)之后是否能得到。既然长度不超过100,那么可以双重循环暴力。最后把两边保留的字符拼起来看一下是不是。,枚举的是保留左边的。,枚举的是保留右边的。

lhschris的博客 432

538A - Cutting Banner

切一段看是否可以组成"CODEFORCES",一个sunstr函数的应用。。。#include #include #include #include #include using namespace std; int main() { string s; while(cin>>s) { int str=s.length(); for(int

Mosu_的专栏 653

A - Cutting Banner(substr()函数)four

题目链接:http://codeforces.com/problemset/problem/538/A解题思路:    several consecutive letters.(可以使用substr()函数)在使用该函数的时候,需要注意:其截取子串的方向为从左到右。最后运行程序的时候,还是runtime error,因此自己检查后发现循环次数只需控制在i &lt;= 10即可。实现代码:#incl...

Lucky_-的博客 378

CF 538A(Cutting Banner-暴力找切割点)

A. Cutting Banner time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A large banner with word CODEFORCES was o

nike0good |Oier&ACMer | 熟能生巧 1780

codeforces 538A

出题人红果果的秀了一回英语“it is possible to cut out of the banner some substring in such a way”,“some substring”的意思是某个子串,“some substrings”才是一些子串OTZ。 题目大意:给一个字符串,从中减去一个子串,是否能变成“CODEFORCES”,水题水水的过,要变成“CODEFORCES

发神经的猫的专栏 853

Codeforces Round #300 A. Cutting Banner 水题

A. Cutting Banner Time Limit: 1 SecMemory Limit: 256 MB 题目连接 http://codeforces.com/contest/538/problem/A Description A large banner with word CODEFORCES was ordered for the 1000-th onsi...

weixin_30245867的博客 87

Codeforces #300 A

A. Cutting Banner time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A large banner with word CODEFORCES was o

qq_27291877的博客 332
上一篇: poj 1789 Truck History (克鲁斯卡尔)
下一篇: codeforces 538 B.Quasi Binary(思维题)
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值