用时15分钟,一开始算成了第L-1行,其实应该算第L行。
#include<iostream>
#include<iomanip>
using namespace std;
double b[12][12];
int main()
{
//freopen("xxx.in","r",stdin);
//freopen("yyy.out","w",stdout);
int L;
char a;
cin >> L >> a;
for(int i=0;i<12;i++)
{
for(int j=0;j<12;j++)
{
cin >> b[i][j];
}
}
double he=0;
for(int i=0;i<12;i++)
{
he=he+b[L][i];
}
if(a=='S')
{
cout << fixed << setprecision(1) << he;
}
else
{
cout << fixed << setprecision(1) << (he/12.0);
}
//fclose(stdin);
//fclose(stdout);
return 0;
}