HDU—— 2203 亲和串
来源:互联网 发布:中国进出口月度数据 编辑:程序博客网 时间:2024/06/14 16:01
题意:中文题目,自行理解。
解题思路:利用C++中的string类型定义两个字符串,然后将母串自身相加依次,即母串变为一个环,然后利用string中的find函数进行查找即可得出结果。详见代码:
Code:
#include <iostream>#include <string>#include <cstdio>using namespace std;int main(){ //freopen("input.txt","r",stdin); int pos; string str1,str2; while(cin>>str1>>str2) { if(str1.length() < str2.length()) cout<<"no"<<endl; else { str1 +=str1; pos = -1; pos = str1.find(str2); if(pos == -1) cout<<"no"<<endl; else cout<<"yes"<<endl; } } return 0;}
0 0
- HDU 2203 — 亲和串
- HDU—— 2203 亲和串
- hdu(2203)——亲和串
- HDU 2203 亲和串
- HDU 2203 亲和串
- HDU - 2203 亲和串
- hdu 2203 亲和串
- hdu 2203 亲和串
- HDU 2203 亲和串
- HDU-亲和串-2203
- hdu 2203 亲和串
- hdu 2203 亲和串
- hdu 2203 亲和串
- hdu 2203 亲和串
- HDU 2203 亲和串
- HDU 2203【亲和串】
- hdu 2203 亲和串
- HDU 2203 亲和串
- 开始做android开发了
- 测试你的耳朵年龄,能听到的频率越大,说明你的年龄越小
- 多柱汉诺塔最优算法设计探究
- c++中不能重载的运算符
- Android Looper和Handler
- HDU—— 2203 亲和串
- Android EditText限制文字长度(中文算2字符,英文算1字符)
- var关键字
- 牛腩 之HTML创建使用网页的文本对齐与格式化
- 【Allwinner ClassA20类库分析】4.GPIO类的使用
- 利用gson解析和生成json数据(二)
- Hibernate 注解中CascadeType用法汇总
- U盘在VMware下启动,虚拟机里优盘的启动方法
- 在网易云课堂开讲MOOC课《面向对象软件开发实践》