Problem 1008 Hay Points

Source: Internet
Author: User

Problem Description

Each employee of a bureaucracy have 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, was used to determine he or her salary.

The Hay point system frees the Human Resources department a intelligent judgement as to Value of the employee; The job description is merely scanned for words and phrases that indicate responsibility. In particular, job descriptions this indicate control over a large budget or management over a large number of people Yiel D high Hay point scores.

Implement a simplified Hay point system. You'll be given a Hay point dictionary and a number of job descriptions. For each job description compute the salary associated with the job, according to the system.

The first line of input contains 2 positive integers: m <=+, the number of words in the Hay point Dictiona Ry, and n <=, the number of job descriptions. m lines follow; Each contains a word (a string of up to lower-case letters) and a dollar value (a real number between 0 and 1,000,000). Following the dictionary is the n job descriptions. Each job description consists of one or more lines of text; For your convenience the text have been converted to lower case and have no characters other than letters, numbers, and SPAC Es. Each job description are 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 a Ppear in the description. Words that does not appear in the dictionary has a value of 0.

Sample Input7 2 Administer 100000 spending 200000 manage 50000 responsibility 25000 expertise all skill money 75000 the Incumbent would administer the spending of kindergarden milk money and exercise responsibility for making change he or she Would share responsibility for the task of managing the money with the assistant whose skill and expertise shall ensure th E Successful spending exercise. This individual must has the skill to perform a heart transplant and expertise in rocket science. Sample Output700150 150 The topic is relatively simple, but for my this kind of English slag is too painful, even to see with a sample of the example finally test instructions understand, is each word corresponds to a number, in a lot of words find how many and those words equal, plus their corresponding numbers on the line, So easy!1#include <iostream>
2usingnamespaceStd
3
4structW
5{
6stringS
7intP
8}k[1100];
9intMain ()
Ten{
OneintN,m,sum;
AstringStr
- while(cin>>n>>m)
-{
the for(intI=1; i<=n;i++)
-cin>>k[i].s>>k[i].p;
-sum=0;
- for(intI=1; i<=m;i++)
+{
- while(cin>>str&&str!=".")
+{
A for(intj=1; j<=n;j++)
atif(K[J].S==STR)
-SUM+=K[J].P;
-}
-cout <<sum<<endl;
-sum=0;
-}
in}
-return 0;
to}View Code

Problem 1008 Hay Points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.