Pro.ID10107 TitleName That Number Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10107 AC0 Submit0 Ratio- 时间&空间限制描述Among the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of this filing system, though, and wish to call the members of their herd by a pleasing name rather than saying, "C'mon, #4734, get along." Help the poor cowhands out by writing a program that will translate the brand serial number of a cow into possible names uniquely associated with that serial number. Since the cow hands all have cellular saddle phones these days, use the standard Touch-Tone(R) telephone keypad mapping to get from numbers to letters (except for "Q" and "Z"): 2: A,B,C 5: J,K,L 8: T,U,V Acceptable names for cattle are provided to you in a file named "namenumdict2015.txt", which contains a list of fewer than 5,000 acceptable cattle names (all letters capitalized). Take a cow's brand number and report which of all the possible words to which that number maps are in the given dictionary which is supplied as namenumdict2015.txt in the grading environment (and is sorted into ascending order). For instance, the brand number 4734 produces all the following names: GPDG GPDH GPDI GPEG GPEH GPEI GPFG GPFH GPFI GRDG GRDH GRDI As it happens, the only one of these 81 names that is in the list of valid names is "GREG". Write a program that is given the brand number of a cow and prints all the valid names that can be generated from that brand number or "NONE" if there are no valid names. Serial numbers can be as many as a dozen digits long. 输入Multiple test cases, one per line, each line with a number from 1 through 12 digits in length. 输出Description Among the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of this filing system, though, and wish to call the members of their herd by a pleasing name rather than saying, "C'mon, #4734, get along." Help the poor cowhands out by writing a program that will translate the brand serial number of a cow into possible names uniquely associated with that serial number. Since the cow hands all have cellular saddle phones these days, use the standard Touch-Tone(R) telephone keypad mapping to get from numbers to letters (except for "Q" and "Z"): 2: A,B,C 5: J,K,L 8: T,U,V Acceptable names for cattle are provided to you in a file named "namenumdict2015.txt", which contains a list of fewer than 5,000 acceptable cattle names (all letters capitalized). Take a cow's brand number and report which of all the possible words to which that number maps are in the given dictionary which is supplied as namenumdict2015.txt in the grading environment (and is sorted into ascending order). For instance, the brand number 4734 produces all the following names: GPDG GPDH GPDI GPEG GPEH GPEI GPFG GPFH GPFI GRDG GRDH GRDI As it happens, the only one of these 81 names that is in the list of valid names is "GREG". Write a program that is given the brand number of a cow and prints all the valid names that can be generated from that brand number or "NONE" if there are no valid names. Serial numbers can be as many as a dozen digits long. Input Multiple test cases, one per line, each line with a number from 1 through 12 digits in length. Output For each test case , output a list of valid names that can be generated from the input, one per line, in ascending alphabetical order. Sample Input 4734 Sample Output GREG Hint 因为需要读入一个字典,本OJ暂无实现。 如果想完成本题,杨帆童鞋了提供原题链接: http://cerberus.delos.com:790/usacoprob2?a=OFyTaMPYf8A&S=namenum 在delos提交时,代码必须加上: freopen( "namenum.in", "r", stdin ); freopen( "namenum.out", "w", stdout ); 代码最前面还要加上类似以下的注释 /* ID: 73660202 <--- 换成自己的账号ID PROG: namenum LANG: C++ */ Source 样例输入4734 样例输出GREG 提示因为需要读入一个字典,本OJ暂无实现。 如果想完成本题,杨帆童鞋了提供原题链接: http://cerberus.delos.com:790/usacoprob2?a=OFyTaMPYf8A&S=namenum 在delos提交时,代码必须加上: freopen( "namenum.in", "r", stdin ); freopen( "namenum.out", "w", stdout ); 代码最前面还要加上类似以下的注释 /* ID: 73660202 <--- 换成自己的账号ID PROG: namenum LANG: C++ */ |