【HDOJ】2585 Hotel
2014-12-23 10:01
183 查看
字符串水题。
#include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 55 char src[MAXN]; char des[MAXN]; bool check(char *s, char *d) { if (*s=='\0' && *d=='\0') return true; if (*s=='*' && *(s+1)=='\0') return true; if (*s == *d) return check(s+1, d+1); else if (*s=='?' && *d) return check(s+1, d+1); else if (*s == '*') { while (*d) { if (check(s+1, d)) // match more than 1 char return true; ++d; } } return false; } int main() { int n; int ans; #ifndef ONLINE_JUDGE freopen("data.in", "r", stdin); #endif while (scanf("%s", src) != EOF) { scanf("%d", &n); ans = 0; while (n--) { scanf("%s", des); if (check(src, des)) ++ans; } printf("%d\n", ans); } return 0; }
相关文章推荐
- HDU 2585 Hotel(字符串的模糊匹配+递归)
- Hdu_2585 Hotel(递归)
- hdu 2585 Hotel 很好的递归模拟题
- HDOJ 2585 maximum shortest distance(求最大团+二分)
- HDU 2585 Hotel
- HDU ACM 16 2585 hotel
- HDOJ 4635: Strongly connected
- 【HDOJ】5154 Harry and Magical Computer
- Hdoj 1026 Ignatius and the Princess I
- ACM--字母序列--HDOJ 1020--Encoding--字符串
- HDOJ 2090 算菜价
- BFS+剪枝--hdoj1195(不错)
- HDOJ 畅通工程 1232(并查集入门)
- HDOJ 2004 成绩转换
- hdoj 2058 The sum problem【数列】
- HDOJ 1201 18岁生日
- HDOJ1000
- 哈希应用----hdoj1840
- 【HDOJ】1109 Run Away
- HDOJ 题目3853 LOOPS(概率DP)