Hay Points
Hay Points
TimeLimit: 1 Second MemoryLimit: 32 Megabyte
Totalsubmit: 1022 Accepted: 602
Description
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
保存事先输入的字符串,在文本中对每个单词进行对比,也是水题,注意细节就行
#include<stdio.h>
#include<string.h>
char str[1010][20];int sum;
int main()
{
int m,t,i,b[20];
char c[100]={'a'};
scanf("%d %d",&m,&t);
getchar();
for(i =0;i < m;i++)
scanf("%s %d",str[i],&b[i]);
getchar();
while(t--)
{
sum =0;
while(strcmp(c,".")!=0)
{
scanf("%s",c);
for(i =0;i < m;i++)
if(strcmp(c,str[i])==0)
{
sum+=b[i];
break;
}
}
getchar();
memset(c,48,sizeof(c)-1);
printf("%d\n",sum);
}
return0;}
Hay Points的更多相关文章
- POJ 2403 Hay Points
Hay Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5735 Accepted: 3695 Descri ...
- Problem 1008 Hay Points
Problem Description Each employee of a bureaucracy has a job description - a few paragraphs that des ...
- Poj 2403 Hay Points(Map)
一.题目大意 实现一个工资计算系统.工资的计算规则是:首先,给定一些关键字和对应的价值,这个相对于字典.然后给出的是求职者的描述,如果这个描述中包含关键字则加上对应的价值,总得价值就是这个求职者的工资 ...
- UVa 10295 - Hay Points
题目:有非常多工人.相应一个能力描写叙述表,每种能力有一个权值,求每一个工人的能力值. 分析:字符串.hash表,字典树.利用散列表或者字典树存储相应的单词和权值.查询就可以. 说明:注意初始化,计算 ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
- poj分类
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- 转载 ACM训练计划
leetcode代码 利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcode. ...
随机推荐
- 100个iOS开发面试题汇总-王刚韧的技术博客
100个iOS开发面试题汇总 关于iOS开发面试,不管对于招聘和应聘来说,面试都是很重要的一个环节,特别对于开发者来说,面试中的技术问题环节不仅是企业对应聘者技能和积累的考察,也是一个开发者自我检验的 ...
- html表格 第五节
表格: <html> <head> <title>表格实例</title> </head> <body> <center& ...
- c++ primer复习(五):类
一:基本内容 1 类 数据成员:用于存储与类对象相关联的状态 成员函数:对数据成员进行操作 类将接口与实现分离,接口指定了类支持的操作,操作的具体实现细节是类的设计者才需要了解 2 类成员 类成员可以 ...
- Headfirst设计模式的C++实现——命令模式(Command)
先看如果不用命令模式的实现: light.h #ifndef _LIGHT_H_ #define _LIGHT_H #include <iostream> class LIGHT { pu ...
- CentOS6.5下docker的安装及遇到的问题和简单使用
Docker是一个开源的应用容器引擎,可以轻松的为任何应用创建一个轻量级的.可移植的.自给自足的容器.利用Linux的LXC.AUFS.Go语言.cgroup实现了资源的独立,可以很轻松的实现文件.资 ...
- HTML标签总结
HTML 基本文档 <!DOCTYPE html> <html> <head> <title>文档标题</title> </head& ...
- mysql统计表的大小
如下是sql语句: SELECT TABLE_NAME as name,DATA_LENGTH+INDEX_LENGTH as len,TABLE_ROWS as rows FROM informat ...
- 【WPF】布局控件总结
<Canvas>:画布,默认不会自动裁减超出内容,即溢出的内容会显示在Canvas外面,这是因为默认 ClipToBounds="False":可设置ClipToBou ...
- (转)搜索Maven仓库 获取 groupid artifactId
转载自:http://blog.csdn.net/z69183787/article/details/22188561 使用Maven进行开发的时候,比较常见的一个问题就是如何寻找我要的依赖,比如说, ...
- Net Core Docker
Net Core Docker轻量级的web框架 .net core现在已经有了大的发展,虽然笔者现在已经从事python开发,但是一直在关注.net的发展,在逛博客园的时候,发现有大家都会提到N ...