python众数问题给定含有n个元素的多重集合s_2-1 问题描述:给定含有n个元素的多重集合S - 下载 - 搜珍网...
問題描述:給定含有n個(gè)元素的多重集合S,每個(gè)元素在S中出現(xiàn)的次數(shù)稱為該元素的重?cái)?shù)。多重集S中重?cái)?shù)最大的元素稱為眾數(shù)。
★算法設(shè)計(jì):對(duì)于給定的由n個(gè)自然數(shù)組成的多重集S,計(jì)算S的眾數(shù)及其重?cái)?shù)。
★數(shù)據(jù)輸入:輸入數(shù)據(jù)由文件名為input.txt的文本文件提供。文件的第1行為多重集S中的元素個(gè)數(shù)n;在接下來的n行中,每行有一個(gè)自然數(shù)。
★結(jié)果輸出: 將計(jì)算結(jié)果輸出到文件output.txt。輸出文件有2行,第一行是眾數(shù),第2行是重?cái)?shù)。
-The descr iption of the problem: given multiple collections S containing n elements, the number of occurrences of each element in S is referred to as the number of a weight for the element. Multiple multiplicity of elements in the set S is called the singular. ★ algorithm design: multiset S given by n natural numbers to calculate the number of all its multiplicity of S. ★ Data Input: input data from a text file named input.txt file. File behavior of a multiple number of elements in the set S n in the next n lines, each line has a natural number. ★ output: the calculation results output to the file output.txt. 2 line in the output file, the first line is plural, the second line is heavy.
(系統(tǒng)自動(dòng)生成,下載前可以參看下載內(nèi)容)
下載文件列表
2-1.cpp
總結(jié)
以上是生活随笔為你收集整理的python众数问题给定含有n个元素的多重集合s_2-1 问题描述:给定含有n个元素的多重集合S - 下载 - 搜珍网...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用这5款免费神器传文件用这5款免费神器传
- 下一篇: 电脑死机的原因如何查看电脑死机原因