-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHDU_2023.cpp
More file actions
46 lines (45 loc) · 745 Bytes
/
HDU_2023.cpp
File metadata and controls
46 lines (45 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
using namespace std;
int main()
{
int n,m;
while (cin>>n>>m)
{
double a[51][6]={0};
int count = 0;
for (int i=0;i<n;i++)
{
for (int j=0;j<m;j++)
{
cin >> a[i][j];
a[i][5] += a[i][j];
a[50][j] += a[i][j];
}
a[i][5] = a[i][5]/m;
}
for (int j=0;j<m;j++)
a[50][j] = a[50][j]/n;
for (int i=0;i<n;i++)
{
printf("%.2f",a[i][5]);
if (i<n-1)
printf(" ");
else
printf("\n");
if (a[i][0]>=a[50][0]&&a[i][1]>=a[50][1]&&a[i][2]>=a[50][2]
&&a[i][3]>=a[50][3]&&a[i][4]>=a[50][4])
count++;
}
for (int j=0;j<m;j++)
{
printf("%.2f",a[50][j]);
if (j<m-1)
printf(" ");
else
printf("\n");
}
cout <<count<<"\n\n";
}
return 0;
}