Donghua University Entrance Examination 2020 on a computer re-examination preparation machine parsing answer questions _ Advanced chapter (31-60)

Article Directory

Foreword

Submit code:
select C++the programming language, because sometimes will use some handy C ++ header files or something, and I have to write code that is part of pure C, as do questions in terms of C's printf and scanf very convenient.

Publish Article arrangement:
I will take the time to send the article to see the schedule, time is a little tight right now. Once the New Year. After the New Year ready to start preparing other things

Problem-solving solution quality:
about my solution and the extent of streamlining the code, I do mind is when the problem to problem solving, because of the rush brushing all the questions, so inevitably there will be some questions should be other better solution , but I use a relatively little violence, after all, was a little big labor intensity, to grasp the progress, if there is a better solution, please contact me, or comment directly, learn together and progress together!

contact details:

If you have questions exchange advice, you can join the QQ group:673852347

Other matters not forgive us!

31 highest frequency

Author: Zhu Kai Time limit: 10S chapters: one-dimensional array

Problem Description :

Obviously father was a famous mathematician. He clearly found in the very young obviously have extraordinary mathematical talent, and therefore intends to develop his interest in mathematics. Once, obviously dad and obviously playing a numbers game, this game is called "the highest frequency." In the game, obviously dad obviously required in a string of numbers, find the numbers that appear most frequently, if there are multiple times the number that appears the same, then take a minimum of that number. Rules of the game clearly understood soon began to play with. Obviously the father gave the first three numbers clearly: 3,2,1; obviously quickly replied: "1" (3,2 although both appear once, but 1 is the smallest number, so the answer is 1). Obviously father obviously very surprised at the speed of the reaction, the difficulty of the game started to increase, given a 6-digit numeric string consisting of: 2,1,3,4,5,2; obviously eyeball a turn, blurted: "2". Obviously the father realized that a simple string of numbers is difficult stumped obviously decided to give a long string of string test obviously. At the same time, my father obviously the face of this long string of numbers, can not be a moment to count the highest number of figures which appear. So he turned to you, let you help him write a program to calculate the highest number out of that number appears. Obviously the father's question boils down to: give you a string of numbers, there are n numbers, numbers that appear most frequently in this digital output string; if there are multiple occurrences of the same figures, the output of which a minimum of that number.

Enter a description:

You need to write the program from a standard input device (typically a keyboard) reads a plurality of sets of test data, each set of test data only one row, each row starts a positive integer n (1 ≤ n ≤ 200), represents the digit string there are n digital; then there are n numbers, n denotes the number of the digit string, where each number is greater than or equal to 1 and less than or equal to 109; separated by a space between each digit. There is no blank line between each test group and the subsequent test data, the test data of the first set of front and behind the last set of test data are also no blank lines.

Output Description:

For each set of test data, you need to write the program to calculate a set of corresponding calculation result, and the result of each operation are sequentially written to standard output device (usually a text terminal to start the program, such as Windows command line terminal). Each operation result to an integer, i.e. the largest number that this number appears in the numeric string; if there are multiple numbers of occurrences as the smallest output that number. Forming a single row each calculation result data, which are the first line and the end of the line without any spaces, there is no blank lines between each set of operation and the subsequent one computation result, the first set of computation results and the foregoing computation result after the last group also they do not have any blank lines.

Input Example:

1 100
5 5 3 77 23 10

Sample output:

100
3

Published 22 original articles · won praise 3 · Views 3774

Guess you like

Origin blog.csdn.net/zhou_hao_ran/article/details/104105548