Problem G: Keywords Search
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 10 Solved: 6
[Submit][Status][Web Board] [Edit] [TestData]
Description
n the modern time, Search engine came into the life of everybody like Google, Baidu, etc.
Wiskey also wants to bring this feature to his image retrieval system.
Every image have a long description, when users type some keywords to find the image, the system will match the keywords with description of image and show the image which the most keywords be matched.
To simplify the problem, giving you a description of image, and some keywords, you should tell me how many keywords will be match.

Input
First line will contain one integer means how many cases will follow by.
Each case will contain two integers N means the number of keywords and N keywords follow. (N <= 10000)
Each keyword will only contains characters 'a'-'z', and the length will be not longer than 50.
The last line is the description, and the length will be not longer than 1000000.

Output
Print how many keywords are contained in the description.

Sample Input
1
5
she
he
say
shr
her
yasherhs
Sample Output
3

#include<iostream>
#include<stdio.h>
#include<string>
#include<string.h>
using namespace std;
char b[];//存放句子
int main()
{
int n,gjc,i,j,len,lena,k,ji,count;
string a[];
while(scanf("%d",&n)!=EOF) //总的测试的个数
{
while(n--)
{
cin>>gjc;//关键词的个数
for(i=;i<gjc;i++)
{
cin>>a[i];
}
getchar();
gets(b);
len=strlen(b);
count=;
for(i=;i<gjc;i++)
{
lena=a[i].size();
for(j=;j<len;j++)
{
ji=;
for(k=;k<lena;k++)
{
if(b[j]!=a[i][k])
{
j=j-ji;
break;
}
else
{
ji++;
j++;
}
}
if(ji==lena)
{
count++;
j=j-lena;
}
}
}
cout<<count<<endl;
}
}
return ;
}

Problem G: Keywords Search的更多相关文章

  1. 【HDU2222】Keywords Search AC自动机

    [HDU2222]Keywords Search Problem Description In the modern time, Search engine came into the life of ...

  2. hdu2222 Keywords Search ac自动机

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=2222 题目: Keywords Search Time Limit: 2000/1000 MS ...

  3. HDU 2222 Keywords Search(AC自动机模版题)

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others ...

  4. HDU2222 Keywords Search [AC自动机模板]

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others ...

  5. C++之路进阶——hdu2222(Keywords Search)

    /*Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...

  6. HDU 2222 Keywords Search(查询关键字)

    HDU 2222 Keywords Search(查询关键字) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K ...

  7. hdu----(2222)Keywords Search(ac自动机)

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  8. hdu----(2222)Keywords Search(trie树)

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  9. Keywords Search

    Keywords Search Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

随机推荐

  1. Java学习疑惑(8)----可视化编程, 对Java中事件驱动模型的理解

    我们编写程序就是为了方便用户使用, 我觉得UI设计的核心就是简洁, 操作过于繁琐的程序让很大一部分用户敬而远之. 即使功能强大, 但是人们更愿意使用易于操作的软件. 近年流行起来的操作手势和逐渐趋于成 ...

  2. Siverlight+WCF+Nhibernate 开发之旅(一)

    最近正在开发sl程序,考虑了很久,参考了一些框架,令人头疼的数据访问层最终选择wcf+nhibernate,至于为什么选择wcf和nh,个人参考了其他的框架感觉这两者结合从开发效率和便捷性方面比其他的 ...

  3. java把函数作为参数传递

    public class Tool { public void a()// /方法a { System.out.print("tool.a()..."); } public voi ...

  4. Unix/Linux环境C编程入门教程(15) BT5开发环境搭建

    1. Backtrack 是处于世界领先地位的渗透测试和信息安全审计发行版本.有着上百种预先安装好的工具软件,并确定能完美运行,Backtrack5 提供了一个强大的渗透测试平台--从Web hack ...

  5. 【POJ】2492 A bug's life ——种类并查集

    A Bug's Life Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 28211   Accepted: 9177 De ...

  6. #include <functional>

    1 bind(引用内部函数, 实体对象的地址, 占位符); 2 bind1st 3 function 1 auto 变量名 = bind(引用内部函数, 实体对象的地址, 占位符); #include ...

  7. javascript数组排序-----1

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. hdu 2102 A计划(双层BFS)(具体解释)

    转载请注明出处:http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://acm.hdu.edu.cn/showproblem.php ...

  9. 菜鸟运维笔记:安装MySQL,PHP及phpMyAdmin

    转载请注明出处:http://blog.csdn.net/guodongxiaren/article/details/40684799 阿里云提示我备案,挺烦人的.前天通过github的学生开发包. ...

  10. oracle 使用 decode函数 或 case when 实现行转列

    ----创建测试表 create table student_score( name varchar2(20), subject varchar2(20), score number(4,1) ); ...