HDU OJ ACM Font Size:← →Problem DescriptionWord's combination is an interesting thing.Given a set of words S={s1,s2,...,sn},where si is a word only consists lowercase letter and its length is less than 50.When si merges in a text,its effect on re

来源:学生作业帮助网 编辑:六六作业网 时间:2024/05/12 18:49:05
HDUOJACMFontSize:←→ProblemDescriptionWord''scombinationisaninterestingthing.GivenasetofwordsS={s1,s2,

HDU OJ ACM Font Size:← →Problem DescriptionWord's combination is an interesting thing.Given a set of words S={s1,s2,...,sn},where si is a word only consists lowercase letter and its length is less than 50.When si merges in a text,its effect on re
HDU OJ ACM
Font Size:← →
Problem Description
Word's combination is an interesting thing.
Given a set of words S={s1,s2,...,sn},where si is a word only consists lowercase letter and its length is less than 50.When si merges in a text,its effect on reader's mood is both positive and negative.A word's positive effect is measured in love level li and negative effect is in hate level hi.
At the same time,given a set paragraph P={P1,P2,...,Pn} and Pj is a string whose length is less than 1000.For each word si in S,there is two conditions in Pj as follows:
Related :si is a substring of Pj,and li units of love level is added to Pj,if si occurs several times in Pj,every occurrence is counted.
Unrelated :si never occurs in Pj and this condition bring Pj nothing.
Text T is defined as a subset of P.T's love level is defined as sum of Pj's love level where Pj belongs to T minus words?hate level.Because a strange psychology phenomenon,hate level of a word which occurs in T is only counted once no matter how many times it occurs.
Given the set of S and P,writing robot's job is to select a subset T to maximum the love level.
Input
The first line of the input contains a single integer T (1 ≤ T ≤ 15),the number of test cases.Then T cases follow.
First line of each case contains 2 integers,S,P.(1≤S,P≤150),then S lines follows,each line contains 2 integers,li,hi,(1≤li≤100,1≤hi≤1000),and a string si with length less than 50.Next P lines,each contains a string Pi with length less than 1000.It guarantees that the answer will not exceed 32-bit signed integer.
Output
For the x-th test case,print "Case x:" and maximum T's profit in a line.Sample Input
2
3 2
2 2 hit
1 2 it
3 1 song
hitman
singasong
2 2
2 3 ab
1 6 ba
ababab
bababa
Sample Output
Case 1:2
Case 2:6

HDU OJ ACM Font Size:← →Problem DescriptionWord's combination is an interesting thing.Given a set of words S={s1,s2,...,sn},where si is a word only consists lowercase letter and its length is less than 50.When si merges in a text,its effect on re
很明显的字典树题目.呵呵
这个你直接百度题号,连解题报告都有了

HDU OJ ACM Font Size:← →Problem DescriptionWord's combination is an interesting thing.Given a set of words S={s1,s2,...,sn},where si is a word only consists lowercase letter and its length is less than 50.When si merges in a text,its effect on re acm刷什么oj好 BODY { FONT-FAMILY:宋体; FONT-SIZE:9pt; background:#fcfff7} TD {FONT-FAMILY:宋体; FONT-SIZE: font size=+1里面的数值是什么意思font size=+1font size=+2font size=-1font size=-2font size=1font size=2这里size中的数值是什么意思? hdu font 不是字体的属性吗?比如.inFo{ font-family:normal; font-size:16px;} font-size:100%是什么意思?A headingA paragraph这段代码我似乎有点看不懂.请大侠帮忙.解释一下.font-size:100%与font-size:20px的关系 鄙人正在做ACM试题,请问现在有哪些大学有OJ? body { font-family:Verdana; font-size:14px; margin:0;} #container {margin:0 auto; width:100%;} #hea 滚珠丝杆的导程是什么?div{font-size:12px;font-family:arial}.baidu{font-size:14px;line-height:24px;font-family:arial} a,a:link{color:#0000cc;}.baidu span{color:#6f6f6f;font-size:12px} a.more{color:#008000;}a.blk{color:#000;font-weight:bold;} 一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit:65536KTotal Submit:229 Accepted:52 [Submit] [Status] [Discuss] Font Size:Aa Aa Aa DescriptionThis problem is so easy:given an positive integer n,you are to find the number of so 一道不难的ACM题,Font Size:Aa Aa Aa Description8是topcoder的幸运数,但是,8的n次方也被认为是幸运数,现在给你一个数x,请判断他是否为幸运数.Input多组测试数据.每行输入一个数x(在int)范围以内.Outpu acm Font Size:← →Problem Description键盘输入一个高精度的正整数n(≤240位),去掉其中任意s个数字后剩下的数字按原左右次序将组成一个新的正整数.编程对给定的n和s,寻找一种方案,使得剩下的数 杭电1163 怎么做?什么思路?http://acm.hdu.edu.cn/showproblem.php?pid=1163 acm 1008 杭电 什么意思请帮我解释一下,谢谢!题目地址 http://acm.hdu.edu.cn/showproblem.php?pid=1008 hdu acm 难度分布问题杭州科技大学acm题目的难度分布是怎么样的越往后越难吗 还是?改正:是杭州电子科技大学 .baidu{font-size:14px;line-height:1.5;}a{color:#0000cc;}什么意思啊 a:link,a:visited {font-size:12px;text-decoration:none;}