Hay Points

​ 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

题解

采用c++的流输入(string用法)即可

#include<string>//Hay Points
#include<iostream>
using namespace std;
struct book
{string l;int val;
}a[1005];
int main()
{int m,n;scanf("%d%d",&m,&n);for(int i=1;i<=m;i++){cin>>a[i].l>>a[i].val;}while(n--){string ch;int sum=0;while(cin>>ch&&ch!="."){for(int i=1;i<=m;i++){if(ch==a[i].l){sum+=a[i].val;}}    }cout<<sum<<endl;}return 0;
}

Hay Points相关推荐

  1. UVA10295 POJ2403 ZOJ1902 Hay Points【map】

    Each employee of a bureaucracy has a job description - a few paragraphs that describe the responsibi ...

  2. POJ2403 Hay Points

    题目链接:http://acm.pku.edu.cn/JudgeOnline/problem?id=2403 复制代码 #include <map> #include <iostre ...

  3. 转载[POJ题型分类]

    北大ACM题分类 主流算法: 1.搜索 //回溯 2.DP(动态规划) 3.贪心 4.图论 //Dijkstra.最小生成树.网络流 5.数论 //解模线性方程 6.计算几何 //凸壳.同等安置矩形的 ...

  4. ACM 网址和一些建议

    USACO http://ace.delos.com/usacogate 美国著名在线题库,专门为信息学竞赛选手准备 TJU http://acm.tongji.edu.cn/ 同济大学在线题库,唯一 ...

  5. 【poj题集整理】【存下来并不会看】

    主要是整理起来自己用的.网上有多个版本. 初级: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)   ...

  6. (精)【ACM刷题之路】POJ题目详细多角度分类及推荐题目

    POJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094) 初期: ...

  7. 初学ACM之路(训练大纲)

    初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj329 ...

  8. Competitive Programming 3题解

    题目一览: Competitive Programming 3: The New Lower Bound of Programming Contests(1) Competitive Programm ...

  9. ACM大量习题题库及建议培养计划

    ACM大量习题题库 ACM大量习题题库  现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge.除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库. USACO h ...

最新文章

  1. 该应用程序可能在其主线程上做过多的工作
  2. expect,spawn用法小结
  3. [USACO18JAN][luoguP4183 ]Cow at Large P
  4. Sphinx编译docs文档
  5. wed6699整站程序下载【首发】
  6. 高清设计素材|自然纸纹理,重构自然与生活的趣味
  7. qt在GUI显示时,将调试信息输出到控制台的设置
  8. Learning Premiere Elements 15 Premiere Elements 15教程 Lynda课程中文字幕
  9. python贪心算法
  10. 从零开始学习CANoe(三)—— 系统变量的创建和使用
  11. 【技术】如何通过局域网连接到惠普HP打印机
  12. 外网访问 虚拟机下的web服务器 设置主机端口与虚拟机ip和端口的映射
  13. 小米网卡驱动linux,小米笔记本pro 15.6寸安装ubuntu16.04无法使用wifi的解决方法
  14. 如何取消福昕阅读器的手型光标里面的向下的箭头
  15. Bayesian Learning via Stochastic Gradient Langevin Dynamics
  16. java拆分日期_java实现日期拆分的方法
  17. Angular项目目录结构
  18. [机器学习]随机森林源码(python)
  19. python基础:廖雪峰的官方网站Python(部分)笔记
  20. **PAT_甲级_1057 Stack (30分) (C++)【字符串处理/栈的模拟/树状数组】

热门文章

  1. 108扫货节完美收官 在线交易额破千万
  2. 《ANTLR 4权威指南 》一导读
  3. 数据迁移工具 - Flyway
  4. 在SpringMVC中使用拦截器(interceptor)拦截CSRF***
  5. [linux]查看文件编码和编码转换
  6. 125 Valid Palindrome
  7. Data truncation: Data too long for column错误分析
  8. 使用Varnish代替Squid做网站缓存加速器的详细解决方案
  9. 一个新的自己从2009年的第一天...
  10. C程序设计语言现代方法09:函数