配置文件恢复(双重匹配)
来源:互联网 发布:手机淘宝为什么打不开 编辑:程序博客网 时间:2024/05/21 11:06
#include<bits/stdc++.h>using namespace std;void split(char a[],vector<string>&v){ char*p=strtok(a," "); while(p!=NULL) { string t; for(int i=0; i<strlen(p); i++) t+=p[i]; v.push_back(t); p=strtok(NULL," "); }}int main(){ char a[1000000]; string cmd1="reset"; string ans1="reset what"; string cmd_first[5]= {"reset","board","board","reboot","backplane"}; string cmd_second[5]= {"board","add","delet","backplane","abort"}; string ans[5]= {"board fault","where to add","no board at all","impossible","install first"}; while(gets(a)!=NULL) { vector<string>v; split(a,v); if(v.size()==1) { if(cmd1.find(v[0])==0) { cout<<ans1<<endl; } else { cout<<"unkown command"<<endl; } } else if(v.size()==2) { int flag=-1; int i; for(i=0; i<5; i++) { if(cmd_first[i].find(v[0])==0&&cmd_second[i].find(v[1])==0) { if(flag==-1) { flag=i; } else { cout<<"unkown command"<<endl; break; } } } if(i==5&&flag==-1) { cout<<"unkown command"<<endl; } else if(i==5&&flag!=-1) { cout<<ans[flag]<<endl; } } else { cout<<"unkown command"<<endl; } } return 0;}
阅读全文
0 0
- 配置文件恢复(双重匹配)
- 配置文件恢复(双重匹配)
- Java实现配置文件恢复 匹配
- 配置文件恢复
- 配置文件恢复
- 配置文件恢复
- 配置文件恢复
- 配置文件恢复
- oracle配置文件丢失恢复
- [编程题]配置文件恢复
- VS 配置文件恢复默认设置
- nginx 匹配配置文件启动
- nginx 匹配配置文件启动
- ORA-19806: 在恢复区内不能进行双重备份
- 挑战面试编程:字符串匹配的双重递归式写法
- 华为机试在线训练-牛客网(31)配置文件恢复
- 文字匹配解析例子(读取Json 格式配置文件)
- tcl语言中的双重替换(双重变量)
- Effective c++ 学习笔记(六)
- ListView 条目显示点击
- hive 换行符特殊字符规避
- mysql的5中查询子句之一where条件查询
- JAVA实现验证码的功能
- 配置文件恢复(双重匹配)
- java web阿里云部署
- IDE/SCSI/VIRTIO区别
- protobuf在使用的时候使用静态链接库方式
- 视觉slam学习资料
- 飞昂之雪 关于springmvc跨域
- Delphi D10.1 移动开发中APP界面基本布局(一)
- UML图中类之间的关系:依赖,泛化,关联,聚合,组合,实现
- Fragment底部栏快速创建