一场2012天津网络预选赛的题,签到题。

但是还是写了三四十分钟,C++和STL太不熟悉了,总是编译错误不知道怎么解决。

一开始用的Char [] 后来改成了string,STL和string搭配起来才好用啊。

 #include <algorithm>
#include <iostream>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map> using namespace std; int N,M,T;
map <string ,int> dic;
string list[];
int table[]={,,,,,,,,,,,,,,,,,,,,,,,,,};
int main()
{
cin >> T;
string s;
while(T--)
{
cin >> N >> M;
for(int i=;i<N;i++) {
cin >> list[i];
}
dic.clear();
for(int i=;i<M;i++)
{
cin >> s;
string num;
for(int k=;k < (int)s.size();k++)
{
num += table[s[k]-'a'] + '';
}
//cout << num << endl;
map<string ,int>::iterator it = dic.find(num);
if(it == dic.end()){
dic.insert(make_pair(num,));
}
else
it->second++;
}
map<string , int>::const_iterator notFound(dic.end());
map<string , int>::const_iterator pos;
for(int i=;i<N;i++)
{
if((pos = dic.find(list[i])) == notFound)
printf("0\n");
else
printf("%d\n",pos->second);
}
}
}

HDU4287-STL模拟水题的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. POJ 2014:Flow Layout 模拟水题

    Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Descr ...

  3. 模拟水题,查看二维数组是否有一列都为1(POJ2864)

    题目链接:http://poj.org/problem?id=2864 题意:参照题目 哈哈哈,这个题discuss有翻译哦.水到我不想交了. #include <cstdio> #inc ...

  4. UVA 10714 Ants 蚂蚁 贪心+模拟 水题

    题意:蚂蚁在木棍上爬,速度1cm/s,给出木棍长度和每只蚂蚁的位置,问蚂蚁全部下木棍的最长时间和最短时间. 模拟一下,发现其实灰常水的贪心... 不能直接求最大和最小的= =.只要求出每只蚂蚁都走长路 ...

  5. Codeforces 1082B Vova and Trophies 模拟,水题,坑 B

    Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn t ...

  6. hdu 4891 模拟水题

    http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...

  7. Mishka and Contest(模拟水题)

    Mishka started participating in a programming contest. There are nn problems in the contest. Mishka' ...

  8. 模拟水题,牛吃草(POJ2459)

    题目链接:http://poj.org/problem?id=2459 题目大意:有C头牛,下面有C行,每头牛放进草地的时间,每天吃一个草,总共有F1个草,想要在第D的时候,草地只剩下F2个草. 解题 ...

  9. 洛谷 1079 Vigenère 密码——模拟水题

    题目:https://www.luogu.org/problemnew/show/P1079 大水题. #include<iostream> #include<cstdio> ...

随机推荐

  1. OK6410移植linux3.3.1

    本文为原创,转载请注明:http://www.cnblogs.com/tolimit/ 首先修改资源代码,进入arch/arm/mach-s3c64xx/目录,在这里我们使用mini6410的资源配置 ...

  2. 如何通过C#开发调用Skyline软件中提供的小工具

    熟悉Skyline的朋友会知道,在TerraBuilder和TerraExplorer Pro软件的安装目录里,提供了很多个小工具(exe程序): 虽然我们看不到这些小工具的源代码,但我们还是可以在自 ...

  3. python 经典博客链接

    1, 从文件的读取与输出: http://www.cnblogs.com/xuxn/archive/2011/07/27/read-a-file-with-python.html http://www ...

  4. 初学Python,对于开发工具不是很了解?一文带你选择适合你的开发工具

    工欲善其事必先利其器!想要获取更多的开发工具安装包.安装教程,可以加群:725479218, 开发Python用什么工具好呢?其实刚学Python的话,使用IDLE就够了,虽然调试不是特别方便,但是对 ...

  5. odoo系统中name_search和name_get用法

    自动带出工序和工序序号,两个条件都能搜索,并且两个都带出来显示在前端: # 输入工序序号会自动带出工序名// def name_search(self, cr,user,name='', args=N ...

  6. 如何学习 Webpack

    webpack-howto Tip: 本文是 webpack-howto 的原文,我觉得这篇文章写得非常好,确实算是目前学习 webpack 入门的必读文章.直接收录之. 本教程的目标 这是一本教你如 ...

  7. [Oracle]发生 ora-06502 RMAN 在对 catalog DB 同期时出错的调查方法

    Catalog DB resync error: 1, setting on the server that starts the RMAN client $ Export EVENT_10928 = ...

  8. pandas:解决groupby().apply()方法打印两次

    对于以下dataframe执行dataframe.groupby(['name', 'course']).apply(lambda x: test(x)) 操作 其中test(x)函数为: def t ...

  9. FreeRTOS 任务与调度器(2)

    在上一篇我们介绍了FreeRTOS任务的一些基本操作和功能,今天我们会介绍一个很好很强大的功能——任务通知 任务通知可以在不同任务之间传递信息,它可以取代二值信号量.计数信号量.事件标志组.深度为1的 ...

  10. *C#(WPF)--矩阵拖动和矩阵动画(拖动展开,不足动画效果)

    最近在研发新的项目,遇到了一个桌面模式下的难点--展开动画.之前动画这方面没做过,也许很多人开始做的时候也会遇到相关问题,因此我把几个重点及实际效果图总结展示出来: 我的开发环境是在VS2017下进行 ...