AcWing 752. 数组的右方区域
原题链接
简单
作者:
flusca
,
2024-10-01 23:36:14
,
所有人可见
,
阅读 1
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double a[12][12];
char t;
cin >> t;
for (int i = 0; i < 12; i++)
for (int j = 0; j < 12; j++) cin >> a[i][j];
double sum = 0, cnt = 0;
for (int i = 1; i < 6; i++)
{
for (int j = 12 - i; j <= 11; j++)
{
sum += a[i][j];
cnt ++;
}
}
for (int i = 6; i < 12; i++)
{
for (int j = i + 1; j <= 11; j++)
{
sum += a[i][j];
cnt ++;
}
}
if (t == 'S') printf("%.1lf", sum);
else printf("%.1lf", sum / cnt);
return 0;
}