题目链接: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. RESTful 架构风格概述

    http://blog.igevin.info/posts/restful-architecture-in-general/(非常好) http://blog.igevin.info/posts/re ...

  2. 计算从A地出发到各个地方的路径及距离

    数据库环境:SQL SERVER 2005 如题,现有bus表数据如下,dstart是起点,dend是终点,distance是两地的距离.

  3. GCDTimer

    #import <Foundation/Foundation.h> @interface JKTimerManager : NSObject + (instancetype)sharedT ...

  4. How To Read a Paper.md

    @ Titile How To Read a Paper.md @ author Keshav, 译 uuplusu   # 1. Intro    1. 读论文重要    2. 没有人教    3. ...

  5. 我也来玩玩WinForm~BeginInvoke让用户体验更好!

    前言 先说明一下,本人不太做winform的项目,工作10年以来,一直奋斗在webform的舞台上,今天有机会也接触了一下winform,下面对工作中用到的BeginInvoke方法作一下说明,和大家 ...

  6. chkconfig-增加一个服务设置服务自启动

    参考 http://www.cnblogs.com/panjun-Donet/archive/2010/08/10/1796873.html 如何增加一个服务: 1.服务脚本必须存放在/etc/ini ...

  7. Centos6.5安装

    前奏:CentOS 6.5下载地址http://mirror.centos.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1to2.torre ...

  8. Jquery OR Js 实现图片预览

    Jquery方法一: <!DOCTYPE html> <html> <head>     <title></title>     <s ...

  9. build tree

    有二叉树的前序遍历和后序遍历,构造二叉树 /** * Definition for binary tree * public class TreeNode { * int val; * TreeNod ...

  10. WPF布局容器综合展示

    Border控件,以及几个重要要的属性:Background:背景的 Brush 对象BorderBrush:用来绘制边框BorderThickness: Border 边框的宽度,设置边框每一边的线 ...