22805_NumericalFrequency

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

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

Pro.ID

22805

Title

Numerical Frequency

Title链接

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

AC

10

Submit

16

Ratio

62.50%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    The National Security Agency (NSA) has invented a new cryptography algorithm. This algorithm is supposed to be completely unbreakable, and is based on several interacting components. One important component is a key based on the date on which a message is sent. The NSA plans to take the factorial of the day of the year, and count the occurrences of each digit.

    Remember that the factorial n! is just n*(n-1)*(n-2) .. * 1. Thus, the factorial 4! is 24. In this example, there is one occurrence of the digit 2: one occurrence of the digit 4, and zero occurrences of every other digit. Your program will be given a list of numbers as input and should output: for each number, the count of each digit, including digits for which the count is zero.

    输入

    Your program will take as input a series of numbers, separated by spaces, and terminated by a 0. All numbers will be integers x such that 1 ≤ x ≤ 366. Do not process the 0; it is a terminator only.

    输出

    Description

    The National Security Agency (NSA) has invented a new cryptography algorithm. This algorithm is supposed to be completely unbreakable, and is based on several interacting components. One important component is a key based on the date on which a message is sent. The NSA plans to take the factorial of the day of the year, and count the occurrences of each digit.

    Remember that the factorial n! is just n*(n-1)*(n-2) .. * 1. Thus, the factorial 4! is 24. In this example, there is one occurrence of the digit 2: one occurrence of the digit 4, and zero occurrences of every other digit. Your program will be given a list of numbers as input and should output: for each number, the count of each digit, including digits for which the count is zero.

    Input

    Your program will take as input a series of numbers, separated by spaces, and terminated by a 0. All numbers will be integers x such that 1 ≤ x ≤ 366. Do not process the 0; it is a terminator only.

    Output

    Your program should process each number and output the number of occurrences for each digit. Each input number should be printed, followed by an ! and a new line. Then, each digit 0-9 should be printed on a separate line; followed by a colon ":" , a single space, and the number of occurrences.

    Sample Input

    3 100 0

    Sample Output

    3!
    0: 0
    1: 0
    2: 0
    3: 0
    4: 0
    5: 0
    6: 1
    7: 0
    8: 0
    9: 0
    100!
    0: 30
    1: 15
    2: 19
    3: 10
    4: 10
    5: 14
    6: 19
    7: 7
    8: 14
    9: 20

    Source

    样例输入

    3 100 0

    样例输出

    3!
    0: 0
    1: 0
    2: 0
    3: 0
    4: 0
    5: 0
    6: 1
    7: 0
    8: 0
    9: 0
    100!
    0: 30
    1: 15
    2: 19
    3: 10
    4: 10
    5: 14
    6: 19
    7: 7
    8: 14
    9: 20

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部