FZU 1008 Hay Points

来源:互联网 发布:淘宝女装描述语 编辑:程序博客网 时间:2024/06/04 18:25

 

Hay Points
Time Limit:1sMemory limit:32MAccepted Submit:399Total Submit:673

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.

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.

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 2administer 100000spending 200000manage 50000responsibility 25000expertise 100skill 50money 75000the incumbent will administer the spending of kindergarden milk moneyand exercise responsibility for making change he or she will shareresponsibility for the task of managing the money with the assistantwhose skill and expertise shall ensure the successful spending exercise.this individual must have the skill to perform a heart transplant andexpertise in rocket science.

Sample Output

700150150

Original: waterloo 020601

 

题目大意:

在某机关的每个员工都有一个关于其所负责工作的描述。这个工作描述表达了该员工的重要性,所以也常被用来决定一个员工的薪资。
人事部门希望能有一个叫做Hay Point的系统,根据每个员工的工作描述,来帮他们自动完成计算薪资的工作。如果某个员工的工作描述中有指出控制大笔经费或管理许多人,那他的Hay Point就会比较高,也就是薪水较高。你的任务就是完成这个Hay Point系统。我们会给你一个 Hay Point的字典以及许多人的工作描述。对每个人的工作描述,请你算出他得到多少Hay Point。
Input
输入的第一列有2个正整数,m,n(m<=1000,n<=100)。m代表在Hay Point字典中有多少字。n代表有多少个工作描述。接下来的m列每列有一个英文单字(最多16个小写字母)及一个实数(就是Hay Point,范围介于0到1000000之间)。在字典之后有n个工作描述,每个描述可能有一到多列。为了方便起见,所有的描述都被转换为小写英文字母,并且除了英文字母,数字,空格符之外没有其它字符。每一工作描述以只含有一句点的一列作为结束。请参考Sample Input。
Output
根据输入的工作描述中的每个字,如果这个字出现在字典中,则得到该字的Hay Point。如果这个字未出现在字典中,则这个字得到0个Hay Point。对每个工作描述,输出这位员工共得到多少Hay Point。

解题:

   重要的是理解题意,对比工作描述,若是与Hay Point 上有相同的工作职能的话,即单词一样的话,就工资叠加。

原创粉丝点击