22336_Zipf'sLaw

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

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

Pro.ID

22336

Title

Zipf's Law

Title链接

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

AC

2

Submit

4

Ratio

50.00%

时间&空间限制

  • Time Limit: 1200/400 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Harvard linguistics professor George Kingsley Zipf (1902-1950) observed that the frequency of the kth most common word in a text is roughly proportional to 1/k. He justified his observations in a book titled Human behavior and the principle of least effort published in 1949. While Zipf's rationale has largely been discredited, the principle still holds, and others have afforded it a more sound mathematical basis.

    You are to find all the words occurring n times in an English text. A word is a sequence of letters. Words are separated by non-letters. Capitalization should be ignored. A word can be of any length that an English word can be.

    输入

    Input consists of several test cases. The first line of each case contains a single positive integer n. Several lines of text follow which will contain no more than 10000 words. The text for each case is terminated by a single line containing EndOfText. EndOfText does not appear elsewhere in the input and is not considered a word.

    输出

    Description
    Harvard linguistics professor George Kingsley Zipf (1902-1950) observed that the frequency of the kth most common word in a text is roughly proportional to 1/k. He justified his observations in a book titled Human behavior and the principle of least effort published in 1949. While Zipf's rationale has largely been discredited, the principle still holds, and others have afforded it a more sound mathematical basis.

    You are to find all the words occurring n times in an English text. A word is a sequence of letters. Words are separated by non-letters. Capitalization should be ignored. A word can be of any length that an English word can be.

    Input
    Input consists of several test cases. The first line of each case contains a single positive integer n. Several lines of text follow which will contain no more than 10000 words. The text for each case is terminated by a single line containing EndOfText. EndOfText does not appear elsewhere in the input and is not considered a word.
    Output
    For each test case, output the words which occur n times in the input text, one word per line, lower case, in alphabetical order. If there are no such words in input, output the following line:
    There is no such word.
    Leave a blank line between cases.
    Sample Input
    2
    
    In practice, the difference between theory and practice is always
    greater than the difference between theory and practice in theory.
    	- Anonymous
    
    Man will occasionally stumble over the truth, but most of the
    time he will pick himself up and continue on.
            - W. S. L. Churchill
    EndOfText
    Sample Output
    between
    difference
    in
    will
    Source

    样例输入

    2
    
    In practice, the difference between theory and practice is always
    greater than the difference between theory and practice in theory.
    	- Anonymous
    
    Man will occasionally stumble over the truth, but most of the
    time he will pick himself up and continue on.
            - W. S. L. Churchill
    EndOfText

    样例输出

    between
    difference
    in
    will

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部