HDU 2585 Hotel(字符串的模糊匹配+递归)
in the web for the information of hotels in California ans got piles of choice. Could you help Max pick out those that might be the right hotel?
In the next line there is one integer n(1<=n<=300)representing the number of hotel Max found ,and then n lines follow.Each line contains one string of lowercase character(s),the name of the hotel.
The length of every string doesn't exceed 50.
#include <iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string> using namespace std; char a[],b[];
int n,len1,len2,res; bool digital(int i,int j)
{
//结尾判定
if(i==len1&&j==len2)
return true;
else if(i==len1||j==len2)
return false;
//中间过程
else if(a[i]=='*')
{
for(int k=j;k<=len2;k++)
if(digital(i+,k))
return true;
}
else if(a[i]=='?'||a[i]==b[j])
digital(i+,j+);
else
return false;
} int main()
{
while(scanf("%s",&a)!=EOF)
{
scanf("%d\n",&n);
len1=strlen(a);
res=;
while(n--)
{
scanf("%s",&b);
len2=strlen(b);
if(digital(,))
res++;
}
printf("%d\n",res);
}
return ;
}
HDU 2585 Hotel(字符串的模糊匹配+递归)的更多相关文章
- HDU 2585 [Hotel]字符串递归处理
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2585 题目大意:马克思要找个曾经去过的很好的旅馆,可惜他记不完整旅馆的名字.他有已知的部分信息和可能的 ...
- HDU 1274 展开字符串 (递归+string类)
题目链接:HDU 1274 展开字符串 中文题. 左括号进入DFS函数,右括号return到上一层. 注意return回去的是这个一层递归中的括号中的字母串. AC代码: #include<st ...
- C++实现的字符串模糊匹配
C++基本没有正则表达式功能,当然像Boost里提供了正则.本文来源于博客园园友的一篇文章,请看: C/C++ 字符串模糊匹配 很早之前就看过这篇文章,原作者的需求很明确.代码实现也很好. 之所以又写 ...
- mysql 两张表字段模糊匹配--字符串拼接函数
concat(A,B,C,...) 拼接字符串 例如concat('123','***','345') =>123***345 SELECT concat( substr(t1.CODE, ...
- 简单易用的字符串模糊匹配库Fuzzywuzzy
简单易用的字符串模糊匹配库Fuzzywuzzy 阅读目录 FuzzyWuzzy 简介 安装 用法 已知移植 FuzzyWuzzy 简介 FuzzyWuzzy 是一个简单易用的模糊字符串匹配工具包.它依 ...
- dev 中 字符串转中文拼音缩写,对grid列表进行模糊匹配,grid获取焦点行,gridlookupedit控件用拼音模糊匹配下拉选项
番外篇:. //该方法是将字符串转化为中文拼音的首写字母大写, public static string RemoveSpecialCharacters(string str){try{if (str ...
- 使用vlookup的模糊匹配和字符串拼接
1,=IF(ISNA(VLOOKUP("*"&$D2&"*",$A$2:$A$43,1,FALSE))=FALSE,TRUE,FALSE) 2, ...
- sql模糊匹配中%、_的处理
防sql注入之模糊匹配中%._处理: StringBuilder sbSql = new StringBuilder(); sbSql.Append(@"SELECT * from tabl ...
- Mysql 模糊匹配和转义字符
首先创建一个测试表: insert into test(tt) values('\\\\172.18.28.153'); 现在我想使用模糊匹配,查出以 “\\172” 开头的字符串. 需要使用like ...
随机推荐
- Matlab-2:二分法工具箱
function g=dichotomy(f,tol) %this routine uses bisection to find a zero of user-supplied %continuous ...
- MySQL 处理海量数据时一些优化查询速度方法
1.应尽量避免在where子句中使用!=或<>操作符,否则将引擎放弃使用索引而进行全表扫描. 2.对查询进行优化,应尽量避免全表扫描,首先应考虑在where及order by设计的列上建立 ...
- idea中查看java类继承图
复习java io,看了书里的这张图,太模糊了,想弄个出来放大看,一开始试了idea发现只能看父类,后来折腾了一会试了其他工具才发现还是idea好用. :) 一.打开type hierachy 光标放 ...
- springcloud之eureka配置——eureka.instance
1.在springcloud中服务的 Instance ID 默认值是: ${spring.cloud.client.hostname}:${spring.application.name}:${sp ...
- mybatis与spring的整合(代码实现)
mybatis与spring的整合(代码实现) 需要jar包: mybatis核心包:依赖包:log4j包:spring croe;beans;tx;aop;aspects;context;expre ...
- HashSet和ArrayList有什么区别
hashSet存储的是无序,不可重复,无索引 ArrayList存储的是有序,可重复,有索引
- [LeetCode] 113. Path Sum II ☆☆☆(二叉树所有路径和等于给定的数)
LeetCode 二叉树路径问题 Path SUM(①②③)总结 Path Sum II leetcode java 描述 Given a binary tree and a sum, find al ...
- 使用Intellij中的Spring Initializr来快速构建Spring Boot/Cloud工程(十五)
在之前的所有Spring Boot和Spring Cloud相关博文中,都会涉及Spring Boot工程的创建.而创建的方式多种多样,我们可以通过Maven来手工构建或是通过脚手架等方式快速搭建,也 ...
- PHP配置方法
由于php是一个zip文件(非install版),安装较为简单,解压就行.把解压的 php5.2.1-Win32重命名为 php5.并复制到C盘目录下.即安装路径为 c:\php5 1 找到php目录 ...
- xadmin自定义关联菜单
网上好多自定义xadmin后台数据很少有关怎样设置外键关联菜单的显示,如下图所示: 现有个需求根据model中status字段值,来显示关联菜单三道杠,如上图app状态只有是审核成功才会显示,未审核不 ...