Problem G: Keywords Search
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的更多相关文章
- 【HDU2222】Keywords Search AC自动机
[HDU2222]Keywords Search Problem Description In the modern time, Search engine came into the life of ...
- hdu2222 Keywords Search ac自动机
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=2222 题目: Keywords Search Time Limit: 2000/1000 MS ...
- HDU 2222 Keywords Search(AC自动机模版题)
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- HDU2222 Keywords Search [AC自动机模板]
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- C++之路进阶——hdu2222(Keywords Search)
/*Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) ...
- HDU 2222 Keywords Search(查询关键字)
HDU 2222 Keywords Search(查询关键字) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K ...
- hdu----(2222)Keywords Search(ac自动机)
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu----(2222)Keywords Search(trie树)
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- Keywords Search
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
随机推荐
- oracle任务计划debug
crontab -eno crontab for root - using an empty onecrontab: installing new crontab"/tmp/crontab. ...
- 【转】Python3.x移除了callable内建函数
原文地址:http://www.cnblogs.com/elvisxu/archive/2010/10/26/1861958.html 最近学习Python的时候,在Python3下跑<Dive ...
- WebService测试工具SoapUI
尊重原著作:本文转载自http://gqsunrise.iteye.com/blog/1958480 1. 简介 SoapUI是用java开发的测试web service的工具. 2. 安装 2.1. ...
- C# Attribute(特性)之---契约---[ServiceContract] 、 [OperationContract]
代码如下 : [ServiceContract] //服务协定定义 using System.ServiceModel; public interface IInterface1 { [Operati ...
- realloc,c语言
realloc #include <stdlib.h> main() { char* ptr=NULL; char* ptr2=NULL; ptr = malloc(); printf(& ...
- Asp.Net请求处理机制中IsApiRuntime解析
今天看了web请求的生命周期,看完了还有些不懂,就是用反编译工具,查看封装内库的内部实现. 从计算机内部查到web.dll,使用反编译工具打开 打开后 public int ProcessReques ...
- Twemproxy 分布式集群缓存代理服务器
Twemproxy 分布式集群缓存代理服务器 是一个使用C语言编写.以代理的方式实现的.轻量级的Redis代理服务器, 它通过引入一个代理层,将应用程序后端的多台Redis实例进行统一管理, 使 应用 ...
- WPF:向客户端发出某一属性值已更改的通知INotifyPropertyChanged接口
Person.cs using System.ComponentModel; namespace _01_INotifyPropertyChanged { class Person:INotifyPr ...
- 智能电视TV开发---直播视频客户端结构设计和实现
在智能电视TV开发---客户端和服务器通信里面我们实现了客户端和服务端的简单通信,接下来我们做一个简单的客户端界面,来实现手机端来操控智能电视的TV端. 一.存储视频的结构设计 我们在做客户端的时候, ...
- AXIS2远程调用WebService示例(Eclipse+AXIS)
转自:http://www.cnblogs.com/lanxuezaipiao/archive/2013/05/10/3071584.html 我们将Web Service发布在Tomcat或者其他应 ...