题目描述
没啥说的…大家加油!
算法1
(暴力枚举) $O(n^2)$
C++ 代码
#include<iostream>
using namespace std;
double a[12][12];
int main()
{
double s = 0,x;
char m;
cin >> m;
for (int i = 0 ; i < 12 ; ++ i)
for (int j = 0 ; j < 12 ; ++ j) scanf("%lf",&a[i][j]);
for (int i = 0 ; i < 12 ; ++ i)
{
for (int j = i + 1 ; j < 12 ; ++ j)
{
s += a[i][j];
}
}
printf("%.1lf",m == 'S' ? s : s / 66.0 );
return 0;
}