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. ...
随机推荐
- asp.net:用类来后台绑定数据源
//封装成一个 using System;using System.Collections.Generic;using System.Linq;using System.Web;using Syste ...
- java新手笔记17 参数
package com.yfs.javase; public class ParamDemo { public static void main(String[] args) { int a = 3, ...
- mysql 账户操作
1.授权 mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’; 权限1,权限2,…权限n代表selec ...
- IOS 学习笔记 2015-03-27 我理解的OC-代理模式
案例1 KCButton.h // // KCButton.h // Protocol&Block&Category // // Created by Kenshin Cui on 1 ...
- bm25
BM25算法,通常用来作搜索相关性平分.一句话概况其主要思想:对Query进行语素解析,生成语素qi:然后,对于每个搜索结果D,计算每个语素qi与D的相关性得分,最后,将qi相对于D的相关性得分进行加 ...
- Jquery中去除左右空格
$.trim(" abc "); jQuery.trim(" abc ");
- 降低IIScup使用率,提高性能
智能提醒webservice在高峰期间CPU使用率达到50%,内存消耗2G优化方法:启用IIS的Web Garden. 步奏如下: 在IIS7中,选择对应的应用程序池 然后右键高级设置. 把其中的最大 ...
- MySQL的基本
MySQL的基本语法 left JOIN 左表匹配右表 有没有内容全部匹配 SELECT Persons.LastName, Orders.OrderNo FROM Persons INNER JOI ...
- CSS禁止Chrome谷歌浏览器激活输入框后自动添加橘黄色边框
Chrome默认会为所有的输入框加上橘黄色的边框,虽然有时候可以使我们的网站看起来更友好,但对自定义的样式是有影响的.当鼠标点击输入框时,在谷歌chrome浏览器中,光标移到输入框时激活输入框会被加上 ...
- html锚点
ID模式 <h3><a href="#start">开始</a></h3> <div> 你好 <b/> &l ...