Each employee of a bureaucracy has a job description — a few paragraphs that describe the responsibilities of the job. The employee’s job description, combined with other factors, such as seniority, is used to determine his or her salary.
    The Hay Point system frees the Human Resources department from having to make an intelligent judgement as to the value of the employee; the job description is merely scanned for words and phrases that indicate responsibility. In particular, job descriptions that indicate control over a large budget or management over a large number of people yield high Hay Point scores.
    You are to implement a simplified Hay Point system. You will be given a Hay Point dictionary and a number of job descriptions. For each job description you are to compute the salary associated with the job, according to the system.
Input
The first line of input contains 2 positive integers: m ≤ 1000, the number of words in the Hay Point dictionary, and n ≤ 100, the number of job descriptions. m lines follow; each contains a word (a string of up to 16 lower-case letters) and a dollar value (a real number between 0 and 1,000,000). Following the dictionary are the n job descriptions. Each job description consists of one or more lines of text; for
your convenience the text has been converted to lower case and has no characters other than letters, numbers, and spaces. Each job description is terminated by a line containing a period.
Output
For each job description, output the corresponding salary computed as the sum of the Hay Point values for all words that appear in the description. Words that do not appear in the dictionary have a value of ‘0’.
Sample Input
7 2
administer 100000
spending 200000
manage 50000
responsibility 25000
expertise 100
skill 50
money 75000
the incumbent will administer the spending of kindergarden milk money
and exercise responsibility for making change he or she will share
responsibility for the task of managing the money with the assistant
whose skill and expertise shall ensure the successful spending exercise
.
this individual must have the skill to perform a heart transplant and
expertise in rocket science
.
Sample Output
700150
150

问题链接:UVA10295 POJ2403 ZOJ1902 Hay Points
问题简述:(略)
问题分析
    简单题不解释,,先给出代码。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA10295 POJ2403 ZOJ1902 Hay Points */#include <iostream>
#include <map>using namespace std;int main()
{int m, n;string s;while(cin >> m >> n) {map<string, int> mp;for(int i = 1; i <= m; i++) {int a;cin >> s >> a;mp[s] = a;}while(n--) {int sum = 0;while(cin >> s && s != ".")sum += mp[s];cout << sum << endl;}}return 0;
}

UVA10295 POJ2403 ZOJ1902 Hay Points【map】相关推荐

  1. JAVA基础-06.集合-15.【Map】

    01_Map集合遍历键找值方式 02_Map集合遍历键值对方式 03_练习_计算一个字符串中每个字符出现次数 04_斗地主案例需求分析 day04 [Map] 主要内容 Map集合 教学目标 能够说出 ...

  2. day04 【Map】

    day04 [Map] 主要内容 Map集合 教学目标 能够说出Map集合特点 使用Map集合添加方法保存数据 使用"键找值"的方式遍历Map集合 使用"键值对" ...

  3. Java 【Map】

    [Map] 主要内容 Map集合 第一章 Map集合 1.1 概述 现实生活中,我们常会看到这样的一种集合:IP地址与主机名,身份证号与个人,系统用户名与系统用户对象等,这种一一对应的关系,就叫做映射 ...

  4. 【51nod】【map】最近的一对

    [51nod][map]最近的一对 题目 解题思路 用map存储数最近出现的位置 要距离最短,更前面出现的对答案没有贡献 如果当前数之前出现过,构成一对,与答案比较 代码 #include<io ...

  5. 涛涛打保龄球 【map】篝火晚会(两道题)

    涛涛打保龄球 目录 [题目描述] [输入格式] [输出格式] [输入样例] [输出样例] [代码] 2. 题目描述 输入格式 输出格式 输入输出样例 输入 #1 输出 #1 说明/提示 代码 (今天的 ...

  6. 最大似然估计【MLE】与最大后验概率【MAP】

    最大似然估计(Maximum likelihood estimation, 简称MLE)和最大后验概率估计(Maximum a posteriori estimation, 简称MAP)是很常用的两种 ...

  7. Spark1.x升级Spark2.x常见异常【map】

    一.创建Spark入口 相较于Spark1.x,Spark2.x最明显的区别就是程序执行入口的区别了,从SparkContext变为SparkSession.相较于SparkContext,Spark ...

  8. 【map】【HDOJ】5233 Gunner II

    http://acm.hdu.edu.cn/showproblem.php?pid=5233 外面有很多树,每棵树顶上有一只鸟,一个数组按从近到远的顺序列出这些树的高度(也就是鸟的高度) 猎人开始从不 ...

  9. [2.7]【CF933A】A Twisty Movement【CF926B】Add Points【CF917A】The Monster【CF919E】Congruence Equation

    文章目录 T1:A Twisty Movement 题目 题解 code T2:Add Points 题目 题解 code T3:The Monster 题目 题解 code T4:Congruenc ...

最新文章

  1. C++11中range-based for loops中与的区别
  2. Windows下的定时任务
  3. Express — 使用步骤
  4. php 筛选数组,2020-07-24 php 通过数组键值对筛选数组
  5. 软件测试之黑盒测试-边界值分析法(理论白话学习/期中期末备考)
  6. Arduino笔记-温度传感器的使用
  7. 发行版迁移及二进制兼容性注意事项
  8. php 判断编码 错误,请教一个 PHP 代码出错的原因(一个简单的计算器)
  9. 中国重汽微服务管理_干货 | 微服务架构下 Spring Cloud OAuth2 通用权限管理系统
  10. javascript 函数,数组,document.write()
  11. Window Operations
  12. shell脚本命令行参数里的空白符
  13. 超详细 CSS动画-animation
  14. Java对接微信、支付宝、银联第三方支付
  15. Windows 如何完整备份驱动
  16. 松翰单片机数码管c语言,松翰单片机定时中断数码管程序
  17. 基于时空大数据的GIS技术,推动网格化管理创新发展
  18. 【代码精读】CVP-MVSNet代码结构详细分析
  19. 思科路由器命令大全(一)
  20. thx是什么意思_thx是什么意思?

热门文章

  1. mysql 1690_mysql error BIGINT UNSIGNED value is out of range in 解决办法
  2. JavaWeb知识总结
  3. Java多线程(四)——多线程数据隔离与共享
  4. 设计模式(一)----简单工厂、工厂方法和抽象工厂区别
  5. golang解析嵌套yaml配置(局部解析)
  6. hadoop的作业提交过程之yarn
  7. Transformations on DStreams之transform的使用 实现黑名单操作/指定过滤
  8. java语言中实现键盘输入_Java程序设计中的键盘输入数据的方法分析
  9. python distance matrix_Python 矩阵转置的几种方法小结
  10. 剑指offer面试题12. 矩阵中的路径(矩阵搜索)(深度优先搜索)(剪枝)