2020牛客暑期多校训练营(第六场)C题

链接:https://ac.nowcoder.com/acm/contest/5671/C
来源:牛客网

2020牛客暑期多校训练营(第六场)C题_第1张图片
2020牛客暑期多校训练营(第六场)C题_第2张图片
2020牛客暑期多校训练营(第六场)C题_第3张图片

#pragma warning (disable:4996)
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define inf 0X3f3f3f3f
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const int maxn = 5e4;
int matrix[220][220];
int summ[220][220];//matrix[i][j]上方的和
int n, m;

int main()
{
     
 int t;
 scanf("%d", &t);
 while (t--)
 {
     
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++)
   for (int j = 1; j <= m; j++)
    scanf("%d", &matrix[i][j]);
  for (int j = 1; j <= m; j++)
   for (int i = 1; i <= n; i++)
    summ[i][j] = summ[i - 1][j] + matrix[i][j];
  double ans = 0.0;
  for (int i = 1; i <= n; i++)
   for (int j = 1; j <= m; j++)
   {
     
    double tmp = summ[i][j] * 1.0 / matrix[i][j];
    ans = max(ans, tmp);
   }
  printf("%.8lf\n", ans);
 }
 return 0;
}

你可能感兴趣的:(acm竞赛)