#include<iostream>
#include<iomanip>
using namespace std;
#define ROWS 55
#define COLUMNS 10
int main()
{
int n, m, ans;
double grade[ROWS][COLUMNS];
double temp_r, temp_c;
bool judge;
while(cin >> n >> m)
{
ans = 0;
for(int i = 0; i < n; i++)
{
temp_r = 0.0;
for(int j = 0; j < m; j++)
{
cin >> grade[i][j];
temp_r += grade[i][j];
}
grade[i][m] = temp_r / m;
}
for(int i = 0; i < m; i++)
{
temp_c = 0.0;
for(int j = 0; j < n; j++)
temp_c += grade[j][i];
grade[n][i] = temp_c / n;
}
for(int i = 0; i < n; i++)
{
judge = true;
for(int j = 0; j < m; j++)
if(grade[i][j] < grade[n][j])
{
judge = false;
break;
}
if(judge)
ans++;
}
for(int i = 0; i < n; i++)
{
if(i != 0)
cout << ' ';
cout << fixed;
cout << setprecision(2) << grade[i][m];
}
cout << endl;
for(int i = 0; i < m; i++)
{
if(i != 0)
cout << ' ';
cout << fixed;
cout << setprecision(2) << grade[n][i];
}
cout << endl;
cout << ans << endl;
cout << endl;
}
return 0;
}
HDU 2023
最新推荐文章于 2022-09-19 18:34:38 发布