中文题

深搜

许久没写鸟,卡在输入问题上...

 #include <iostream>
#include <string>
using namespace std;
bool flg;
int n;
char str[][];
bool used[];
void dfs(int p)
{
int i;
if (p >=n || flg) return;
if (str[p][] == 'm')
{
flg = true;
return;
}
for (i=; i<n; i++)
if (!used[i] && str[i][] == str[p][])
{
used[i] = true;
dfs(i);
used[i] = false; }
}
int main()
{ int i;
string tmp;//="12345";
//cout<<tmp.back()<<endl;
while (cin>>tmp && tmp[] != '')
{
i=;
flg = false;
memset(used, false, sizeof(used));
str[i][] = tmp[];
str[i++][] = tmp[tmp.length()-];
while (cin>>tmp && tmp[] != '')
{
str[i][] = tmp[];
str[i++][] = tmp[tmp.length()-];
}
n = i;
for (i=; i<n; i++)
if (!flg && str[i][] == 'b')
{
used[i] = true;
dfs(i);
used[i] = false;
}
if (flg)
cout<<"Yes."<<endl;
else cout<<"No."<<endl;
}
}

最新文章

  1. Linux进阶文件系统管理之RAID
  2. javascript之八——BOM
  3. HTML5学习总结-10 Android 控件WebView显示网页
  4. 1. dex和Jar反编译对比
  5. orcale 动态执行语句
  6. Jsoup开发简单网站客户端之读取本地html文件
  7. Java web 项目 tomcat部署方式.
  8. Android--Toast时间
  9. Oracle EBS-SQL (BOM-2):检查期间Bom的更改记录数.sql
  10. emwin之创建窗口与窗口回调函数的句柄是一致的
  11. yum upgrade卡在 清理initial-setup-0.3.9.30-1.el7.centos.x86_64
  12. TOP100summit【分享实录-网易】构建云直播分发网络
  13. Shiro学习笔记五(Shiro标签,及通配符)
  14. 行为类模式(四):迭代器(Iterator)
  15. Jquery-无法有效获取当前窗口高度
  16. AFO预定
  17. mvc 页面方法学习-RenderBody方法
  18. 架构-LAMP特级学习(网站大访问量解决方案)
  19. OpenERP how to set the tree view limit
  20. python学习之老男孩python全栈第九期_day017知识点总结——初识递归、算法

热门文章

  1. 【Hadoop】MapReduce笔记(一):MapReduce作业运行过程、任务执行
  2. 20个Flutter实例视频教程-01节底部导航栏和切换效果的制作-1
  3. Codeforces 176B【计数DP】
  4. 利用idea创建一个基本的smm项目(带增删改查)
  5. 海思3559A QT 5.12移植(带webengine 和 opengl es)
  6. iOS中UIWebView使用JS交互
  7. max函数的用法
  8. 牛客练习赛42C(枚举权值)
  9. Virtual Judge使用指南
  10. 1049 - Deg-route