当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1171:Letter Game

题目描述

Figure 1:Each of the 26 lowercase letters and its value


Letter games are popular at home and on television. In one version of the game, every letter has a value, and you collect letters to form one or more words giving the highest possible score. Unless you have 'a way with words', you will try all the words you know, sometimes looking up the spelling, and then compute the scores. Obviously, this can be done more accurately by computer.
Given the values in Figure 1, a list of English words, and the letters collected: find the highest scoring words or pairs of words that can be formed,in which a letter must not occur more often than in the collected letters.
输入解释
Your program is to read from standard input. The first line contains a string of lowercase letters (from 'a' to 'z'): the letters collected. The string consists of at least 3 and at most 7 letters in arbitrary order.
From the second line, there is a dictionary consisting of at most 40,000 lines. At the end of the dictionary is a line with a single period ('.'). Each of the other lines contains a string of at least 3 and at most 7 lowercase letters. The dictionary is sorted alphabetically and contains no duplicates.
输出解释
Your program is to write to standard output. You should output one line with the highest score.
输入样例
prmgroa
profile
program
prom
rag
ram
rom
.
输出样例
24
提示
Huge input,scanf is recommended.

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 IOI 1995

源链接: POJ-1171

最后修改于 2020-10-29T05:54:37+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000