HDU-2023 Average score

这是一篇关于HDU-2023编程题目的博客,主要讨论如何计算班级中每个学生和每门课程的平均成绩,并找出分数高于或等于平均分的学生数量。题目要求处理多个测试用例,输入包含学生数和课程数,以及学生的各科成绩,输出包括学生平均分、课程平均分以及高于平均分的学生数,结果保留两位小数。
摘要由CSDN通过智能技术生成

See the article on https://dyingdown.github.io/2019/12/20/HDU-2023%20Average-score/

Average Score

Suppose there are n (n <= 50) students in a class, and each person tests m (m <= 5) courses. Find the average grade of each student and the average grade of each course, and output the scores of each subject greater than or equal Average number of students.

Input

The input data has multiple test instances. The first line of each test instance includes two integers n and m, which represent the number of students and the number of courses, respectively. Then there are n rows of data, each row contains m integers (ie: test scores).

Output

For each test instance, output 3 rows of data. The first row contains n data, which represents the average grade of n students, with two decimal places in the result. The second row contains m data, which represents the average grade of m courses. Results Keep two decimal places; the third line is an integer that indicates the number of students in each class whose grades are greater than or equal to the average grade.
Each test instance is followed by a blank line.

Sample Input

2 2
5 10
10 20

Sample Output

7.50 15.00
7.50 15.00
1

Analysis

This problem is very disgusting. No tricks but you need to be very careful or you will not be able to make it.

Every time I write this problem, I need to WA many many to get one AC.

I’ve tried to count the average while inputting. However I don’t know what’s wrong because all my own test cases are right but gets WA always. So I change in the complex way.

Code

#include<bits/stdc++.h>

using namespace std;

int main() {
   
	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值