52ky 发表于 2022-10-1 18:16:28

对参赛结果分数进行处理

三11.对参赛成果分数进行管理:参赛选手n人(ngt;1),评委m人(mgt;2),评委给每一选手打一个分数score(分数score为小于等于10的一个正实数)。选手的最终得分lastScore计算方法为(1)mlt;9时,去掉一个最高分和一个最低分后另m-2个得分的平均值。(2)m≥9时,去掉两个最高分和两个最低分后另m-4个得分的平均值。假定事前现已搭建了text型的数据文件f1.txt,其间顺次记录着n个选手的编号(一个正整数)、名字(一个字符串)以及m个评委给出的得分。请编制程序,顺次从数据文件f1.txt中读入n个选手的相关信息,而后按上述规则方法计算出每一个选手的最终得分,并且往屏幕上以及另一个text型文件f2.txt中一起输出如下方式的成果信息。假定参赛选手人数n=5,评委人数m=7,磁盘文件f1.txt中的初始数据为:1zhangjin8.89.37.98.78.99.79.22lintao8.98.28.68.88.59.19.33guojian8.98.48.78.68.68.48.64maling7.98.38.58.68.58.98.35liuyifan9.59.19.89.29.09.58.9那么,程序履行后,屏幕显示成果以及磁盘文件f2.txt中的成果均应该为:----------------------------------------------------------参赛号?名字?最高分?最低分?累积分?最终得分----------------------------------------------------------?1zhangjin??9.7??7.9??44.9??8.98?2?lintao??9.3??8.2??43.9??8.78?3?guojian??8.9??8.4??42.9??8.58?4?maling??8.9??7.9??42.2??8.44?5liuyifan??9.8??8.9??46.3??9.26----------------------------------------------------------考虑:可进一步考虑找出竞赛的第1至第k名,也在屏幕以及f2.txt中一起输出相关的成果信息(k小于等于n,并规则若多个选手最终得分相一起,则有效分(即已删去本来的最高分后)中最高分高者名次优先)。源程序如下:
参赛成果分数进行管理.doc

(III. 11. Managing the scores of the entries: n contestants (ngt; 1), m judges (mgt; 2), and the judges give each contestant a score (the score is a positive real number less than or equal to 10). The final score of the contestant is calculated as (1) mlt; At 9:00, the average of the other m-2 scores after removing the highest score and the lowest score. (2) When m ≥ 9, the average of the other m-4 scores after removing the two highest scores and the two lowest scores. Suppose that a text type data file f1.txt has been built in advance, in which n contestants' numbers (a positive integer), names (a string) and scores given by m judges are recorded successively. Please prepare a program to read the relevant information of n contestants from the data file f1.txt in turn, and then calculate the final score of each contestant according to the above rules and methods, and output the result information in the following way to the screen and another text file f2.txt. Assuming the number of contestants n=5, the number of judges m=7, the initial data in the disk file f1.txt is: 1zhangjin8.89.37.98.78.99.79.22lintao8.98.28.68.88.59.33guojian8.98.48.68.68.68.44saling7.98.38.38.68.58.98.35liuyifan9.59.19.89.29.09.98.9 Then, after the program executes, the results displayed on the screen and the results in the disk file f2.txt should be: ------------------------------------------------------------ Contest No? name? Highest score? Lowest score? Accumulated points? Final score ------------------------------------------------------------? 1zhangjin?? 9.7?? 7.9?? 44.9?? 8.98? 2? lintao?? 9.3?? 8.2?? 43.9?? 8.78? 3? guojian?? 8.9?? 8.4?? 42.9?? 8.58? 4? maling?? 8.9?? 7.9?? 42.2?? 8.44? 5liuyifan?? 9.8?? 8.9?? 46.3?? 9.26 ---------------------------------------------------------------------------- Consideration: further consideration can be given to finding the first to the kth place in the competition, and also output relevant results information on the screen and in f2.txt (k is less than or equal to n, and the rule is that if multiple contestants finally get points together, the highest score in the valid score (that is, after the original highest score has been deleted) will prevail). The source program is as follows:
Manage the score of entries. doc)




页: [1]
查看完整版本: 对参赛结果分数进行处理