标签:
#include "stdio.h"
int main(){
int a[55][6];
double pingjun[55],mk[6];
int n,m,i,j,sum=0,count=0,flag=0;
while(~scanf("%d%d",&n,&m)){
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&a[i][j]);
sum+=a[i][j];
}
pingjun[i]=(double)sum/m;
sum=0;
}
for(i=0;i<m;i++){
for(j=0;j<n;j++){
sum+=a[j][i];
}
mk[i]=(double)sum/n;
sum=0;
}
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(a[i][j]>=mk[j])
count++;
}
if(count==m)
flag++;
count=0;
}
for(i=0;i<n;i++){
if(i!=n-1)
printf("%.2lf ",pingjun[i]);
else
printf("%.2lf\n",pingjun[i]);
}
for(i=0;i<m;i++){
if(i!=n-1)
printf("%.2f ",mk[i]);
else
printf("%.2f\n",mk[i]);
}
printf("%d\n",flag);
flag=0;
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/sureli/p/5090312.html