题目链接: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. 动态库DLL加载方式-静态加载和动态加载

    静态加载: 如果你有a.dll和a.lib,两个文件都有的话可以用静态加载的方式: message函数的声明你应该知道吧,把它的声明和下面的语句写到一个头文件中 #pragma comment(lib ...

  2. 如何使用event 10049分析定位library cache lock and library cache pin

    Oracle Library Cache 的 lock 与 pin 说明 一. 相关的基本概念 之前整理了一篇blog,讲了Library Cache 的机制,参考: Oracle Library c ...

  3. C# 之【获取网页】

    C#获取指定网页HTML原代码可使用 WebClient WebRequest HttpWebRequest 三种方式来实现. 当然也可使用webBrowse!在此就不研究webBrowse如何获取了 ...

  4. 【HDU1402】【FNT版】A * B Problem Plus

    Problem Description Calculate A * B.   Input Each line will contain two integers A and B. Process to ...

  5. codeblocks调试(转载)

    单步调试  1)设置断点  在需要设置断点处,右击左边行号,Add breakpoint,则出现一个红色的点(可以同时设置多个,前提是不能在debug的运行模式下). 2)调试运行 Debug-> ...

  6. angularJs工作日记-自定义指令Directive01

    新项目组使用完善的angularMVVM设计思路架构,很庆幸能够来到这个项目组,在这里的每一天都能够学习到新的知识,为了防止以后忘记,记录一下个人的理解 首先接触最多的是directive,direc ...

  7. Unity NGUI和UGUI与模型、特效的层级关系

    目录 1.介绍两大UI插件NGUI和UGUI 2.unity渲染顺序控制方式 3.NGUI的控制 4.UGUI的控制 5.模型深度的控制 6.粒子特效深度控制 7.NGUI与模型和粒子特效穿插层级管理 ...

  8. android code 和js的交互

    小弟现在需要android code 和js的交互.出现了问题,求大家带一带啊. 我的页面:<!DOCTYPE html><html lang="en">& ...

  9. linux自定义开机启动服务

    转 http://www.cnblogs.com/jimeper/archive/2013/03/12/2955687.html 手工创建服务 1.在/etc/rc.d/init.d目录下创建shel ...

  10. 4542: [Hnoi2016]大数

    Description 小 B 有一个很大的数 S,长度达到了 N 位:这个数可以看成是一个串,它可能有前导 0,例如00009312345.小B还有一个素数P.现在,小 B 提出了 M 个询问,每个 ...