帮忙translate一下Name That NumberAmong the large Wisconsin cattl

帮忙translate一下
Name That Number
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
3:D,E,F 6:M,N,O 9:W,X,Y
4:G,H,I 7:P,R,S
Acceptable names for cattle are provided to you in a file named "dict.txt",which contains a list of fewer than 5,000 acceptable cattle names (all letters capitalized).Take a cow's brand number and report whi
(接上)ch supplied as dict.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
GREG GREH GREI GRFG GRFH GRFI GSDG GSDH GSDI GSEG GSEH GSEI
GSFG GSFH GSFI HPDG HPDH HPDI HPEG HPEH HPEI HPFG HPFH HPFI
HRDG HRDH HRDI HREG HREH HREI HRFG HRFH HRFI HSDG HSDH HSDI
HSEG HSEH HSEI HSFG HSFH HSFI IPDG IPDH IPDI IPEG IPEH IPEI
IPFG IPFH IPFI IRDG IRDH IRDI IREG IREH IREI IRFG IRFH IRFI
ISDG ISDH ISDI ISEG ISEH ISEI ISFG ISFH ISFI
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.
小猪在恋爱 1年前 已收到1个回答 举报

linda_wulinjia 春芽

共回答了13个问题采纳率:92.3% 举报

其中威斯康星州的大牛牧场主,这是习惯的品牌,奶牛的序号,请会计部.牛手不欣赏的优势,这个备案系统,虽然,不妨呼吁各成员他们的畜群由一个可喜的名称,与其说,“ c'mon ,编号4734 ,友好相处” .帮助穷人cowhands所撰写...

1年前

4
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.033 s. - webmaster@yulucn.com