#include <iostream>
#include <string>
#define MAXN 50
using namespace std; struct node
{
node * l;
node * r;
bool boo;
node()
{
l = NULL;
r = NULL;
boo = false;
}
}; bool ans; int _index; node res[*MAXN+]; node * insert(node * root,string s,int index,int len)
{
if(s[index] == '')
{
if(root->l == NULL)
{
root->l = &res[_index ++];
root->l->boo = false;
root->l->l = root->l->r = NULL;
if(index == len-)
{
root->l->boo = true;
return root;
}
}
else
{
if(index == len-)
{
ans = false;
return root;
}
if(root->l->boo == true)
{
ans = false;
return root;
}
} root->l = insert(root->l,s,index+,len);
return root;
}
else
{
if(root->r == NULL)
{
root->r = &res[_index ++];
root->r->boo = false;
root->r->l = root->r->r = NULL;
if(index == len-)
{
root->r->boo = true;
return root;
}
}
else
{
if(index == len-)
{
ans = false;
return root;
}
if(root->r->boo == true)
{
ans = false;
return root;
}
}
root->r = insert(root->r,s,index+,len);
return root;
}
} int main()
{
//freopen("acm.acm","r",stdin);
string s;
int time = ;
while(cin>>s)
{
_index = ;
ans = true;
node * root = &res[_index ++];
root->boo = false;
root->l = root->r = NULL;
if(ans)
{
root = insert(root,s,,s.length());
}
while(cin>>s)
{
if(s == "")
{
break;
}
if(ans)
{
root = insert(root,s,,s.length());
}
}
cout<<"Set "<<++ time;
if(ans == false)
{
cout<<" is not immediately decodable"<<endl;
}
else
{
cout<<" is immediately decodable"<<endl;
}
}
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

最新文章

  1. Java GC回收机制
  2. background-position的百分比
  3. javaWeb 使用jsp开发 foreach 标签
  4. BootStrap入门教程 (四) :JQuery类库插件(模态窗口,滚动监控,标签效果,提示效果,“泡芙”效果,警告区域,折叠效果,旋转木马,输入提示)
  5. C# Oracle海量数据瞬间插入到数据库的方法
  6. 玩转Android之数据库框架ActiveAndroid的使用
  7. javascsript 去除数组重复数据
  8. volley三种基本请求图片的方式与Lru的基本使用:正常的加载+含有Lru缓存的加载+Volley控件networkImageview的使用
  9. 哈,又一款超级简单的队列(MQ)实现方案来了~
  10. Linux系列教程(四)——Linux文件和目录处理命令
  11. Thinkphp拖拽上传文件-使用webuploader插件(自己改动了一些地方)——分片上传
  12. myeclipse中的HTML页面在浏览器中显示为乱码
  13. 学JAVA第三天,JAVA第二章《JAVA数据类型》
  14. png8、16、24、32位的区别
  15. HOOK IDT频繁蓝屏(Window 正确 HOOK IDT)
  16. 《Netty权威指南》(二)NIO 入门
  17. Image控件Stretch属性
  18. javascript -- canvas绘制曲线
  19. WDA-FPM-2-APPLICATION-TABSTRIP(OIF)
  20. Paper Reading - Deep Visual-Semantic Alignments for Generating Image Descriptions ( CVPR 2015 )

热门文章

  1. 2018.09.15 bzoj1977:次小生成树 Tree(次小生成树+树剖)
  2. C++之new/delete/malloc/free详解
  3. 如何将word中的图片和文字导入自己的博客中
  4. Md5 util
  5. Android线程和线程Handler基础一览
  6. Java设计模式 -- 简单工厂模式(SimpleFactory)
  7. (线段树)敌兵布阵--hdu--1166 (入门)
  8. New JVM Option Enables Generation of Mixed-Mode Flame Graphs
  9. Visual C++中的ADO编程
  10. Linux下配置Nginx(在root的/etc/rc.local里配置开机启动功能http://tengine.taobao.org/)