题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4287

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std; const int maxn = ;
const int maxm = 1e6; int num[maxm];
int map[] = { ,,,,,,,,,,,,,,,,,,,,,,,,, }; int a[] = {,,,,,}; int main()
{
//freopen("E:\\acm\\input.txt","r",stdin);
int T;
cin>>T;
while(T--){
int N,M;
scanf("%d %d",&N,&M);
int Q[maxn];
for(int i=;i<=N;i++) scanf("%d",&Q[i]);
memset(num,,sizeof(num));
for(int i=;i<=M;i++){
char s[];
scanf("%s",s);
int len = strlen(s);
int sum = ,cnt =;
for(int i=len-;i>=;i--){
int temp = map[s[i]-'a'];
sum += temp * a[cnt++];
}
num[sum]++;
}
for(int i=;i<=N;i++)
printf("%d\n",num[Q[i]]);
}
return ;
}

hdu 4287的更多相关文章

  1. HDU 4287 Intelligent IME(字典树数组版)

    Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  2. HDU 4287 Intelligent IME hash

    Intelligent IME Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...

  3. HDU 4287 Intelligent IME(map运用)

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

  4. HDU 4287 Intelligent IME(string,map,stl,make_pair)

    题目 转载来的,有些stl和string的函数蛮好的: //numx[i]=string(sx); //把char[]类型转换成string类型 // mat.insert(make_pair(num ...

  5. HDU 4287 Intelligent IME

    Intelligent IME Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  6. HDU 4287 (13.08.17)

    Problem Description We all use cell phone today. And we must be familiar with the intelligent Englis ...

  7. HDU 4287 Intelligent IME(字典树)

    在我没用hash之前,一直TLE,字符串处理时间过长,用了hash之后一直CE,(请看下图)我自从经历我的字典树G++MLE,C++AC以后,一直天真的用C++,后来的CE就是因为这个,G++才支持这 ...

  8. ACM学习历程—HDU 4287 Intelligent IME(字典树 || map)

    Description We all use cell phone today. And we must be familiar with the intelligent English input ...

  9. Intelligent IME HDU - 4287 字典树

    题意: 给你m个字符串,每一个字符对应一个数字,如下: 2 : a, b, c    3 : d, e, f    4 : g, h, i    5 : j, k, l    6 : m, n, o ...

随机推荐

  1. Struts2单文件上传

    第一步:首先写个上传文件的页面(简单的一个form表单) <html> <head> <meta http-equiv="Content-Type" ...

  2. oracle数据库导入导出命令!(转)

    oracle数据库导入导出命令! Oracle数据导入导出imp/exp 功能:Oracle数据导入导出imp/exp就相当与oracle数据还原与备份. 大多情况都可以用Oracle数据导入导出完成 ...

  3. 网页快照 - C#实现

    /// <summary> /// 图片类型枚举 /// </summary> public enum ImageType { GIF = , JPG = , PNG = } ...

  4. 百度前端技术学院(IFE)2016春季学期总结

    今天(5月16日)作为第八个提交者提交了任务五十:RIA微型问卷管理平台 这样一个综合性的大任务,宣告我的IFE春季学期课程学习顺利完成.其实任务五十并不复杂,现在再让我来做,可能一周不到就写出来了, ...

  5. 从1到n整数中1出现的次数

    题目如题 如 5 中1出现的次数 为1 12中1出现的次数为5 public class NumberOf1Between1AndN { /* *输入一个整数n,求从1到n这N个十进制表示中1出现的次 ...

  6. Memcached认知[分布式]

    Memcached是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载. Memcached的服务器客户端通信使用简单的基于文本行的协议. Memcached基于一个存储键/值对的 ...

  7. ffmpeg与RTMP流媒体连接用法(翻译) http://www.chinavideo.org/forum.php?mod=viewthread&tid=15423

    最近浏览国外网站时候发现,翻译不准确的敬请谅解. 1.将文件当做直播送至liveffmpeg -re -i localFile.mp4 -c copy -f flv rtmp://server/liv ...

  8. 网页解析Jsoup简单使用

    public static void main(String[] args) throws IOException { //System.out.println("Hello World!& ...

  9. Win8 +PHP+IIS配置

    1.安装IIS:控制面板-程序和功能-打开或关闭Windows功能 2.配置PHP环境 -添加ISAPI筛选: -添加脚本映射:

  10. CentOS+Apache+php无法访问redis的解决方法

    PHP 使用 Redis 安装 开始在 PHP 中使用 Redis 前, 我们需要确保已经安装了 redis 服务及 PHP redis 驱动,且你的机器上能正常使用 PHP. 接下来让我们安装 PH ...