Code Forces 538 A. Cutting Banner(水~)
来源:互联网 发布:存储卡数据修复 编辑:程序博客网 时间:2024/06/05 20:31
Description
切去一个字符串的某个子串后问剩余部分是否可能是CODEFORCES
Input
一个字符串
Output
如果切去某个子串后可以变成CODEFORCES则输出YES,否则输出NO
Sample Input
DECODEFORCES
Sample Output
YES
Solution
从字符串两端分别与目标串进行匹配直至不能匹配,记录匹配终点res1,res2,则当res2<=reas1就可以切出CODEFORCES,否则则不能
Code
#include<stdio.h>#include<string.h>int main(){ char s[105],c[11]={"CODEFORCES"}; int i,res1,res2,len; gets(s); len=strlen(s); i=0; res1=0; while(s[i]==c[res1]) { i++; res1++; } res1--; i=len-1; res2=9; while(s[i]==c[res2]) { i--; res2--; if(res2<=res1) break; } puts(res2<=res1?"YES":"NO"); return 0;}
0 0
- Code Forces 538 A. Cutting Banner(水~)
- 538A - Cutting Banner
- codeforces 538 A.Cutting Banner
- codeforces 538 A Cutting Banner
- Code Forces 592 A. PawnChess(水~)
- codeforces A. Cutting Banner
- A. Cutting Banner
- Code Forces 560 A. Currency System in Geraldion(水~)
- Code Forces 559 A. Gerald's Hexagon(水~)
- Code Forces 535 A. Tavas and Nafas(水~)
- Code Forces 557 A. Ilya and Diplomas(水~)
- Code Forces 567 A. Lineland Mail(水~)
- Code Forces 581 A. Vasya the Hipster(水~)
- Code Forces 583 A. Asphalting Roads(水~)
- Code Forces 584 A. Olesya and Rodion(水~)
- Code Forces 586 A. Alena's Schedule(水~)
- Code Forces 580 A. Kefa and First Steps(水~)
- Code Forces 591 A. Wizards' Duel(水~)
- 2、朴素贝叶斯法
- to_char()函数返回日期格式为年月日时分秒格式
- 开发团队的效率
- hdfs shell命令记录
- Android Recycler View Header Footer 下拉刷新,自动加载更多,空view,loading view
- Code Forces 538 A. Cutting Banner(水~)
- Java 中常用缓存Cache机制的实现
- hdoj 2588GCD(欧拉函数)
- 类型转换(C*)pB
- 那不勒斯中文离线地图App上线
- 抽象工厂模式
- 一个HashMap和TreeSet综合使用的小例子
- 操作mysql的笔记
- 噩梦射手5 移动 转向 这个没有加速的过程 不适合rpg人物 把移动检测去掉