标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 74055 Accepted Submission(s):
17809
#include<stdio.h>
#include<math.h>
double n,m,a[70][7],k[9],y=0,u=0,sum=0;
int i,j;
int main()
{
while(scanf("%lf%lf",&n,&m)!=EOF)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
scanf("%lf",&a[i][j]);
}
for(i=1;i<=n;i++) // n个学生的平均成绩
{
for(j=1;j<=m;j++)
sum+=a[i][j];
if(i!=n)
printf("%.2f ",sum/m);
if(i==n)
printf("%.2f\n",sum/m);
sum=0;
}
sum=0;
for(i=1;i<=m;i++) //m门课的平均成绩
{
for(j=1;j<=n;j++)
sum+=a[j][i];
k[i]=sum/n;
if(i!=m)
printf("%.2f ",k[i]);
if(i==m)
printf("%.2f\n",k[i]);
sum=0;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++) //班级中各科成绩均大于等于平均成绩的学生数量
{
if(a[i][j]>=k[j])
y++;
if(y==m)
u++;
}
y=0;
}
printf("%.0f\n",u);
printf("\n");
u=0;
y=0;
sum=0;
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4373418.html