10107_NameThatNumber

2022-5-16 18:16| 发布者: Hocassian| 查看: 78| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504558641400-Problem List-采集的数据-后羿采集器.html

Pro.ID

10107

Title

Name That Number

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10107

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 600/300 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 "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
    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.

    输入

    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
     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 "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
    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.

    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++

    */


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部