题目描述
blablabla
样例
blablabla
C++ 代码
#include <bits/stdc++.h>
using namespace std;
string DoubleToStringByStdToString(double value)
{
const std::string& new_val = std::to_string(value);
return new_val;
}
int main()
{
char str;
cin>> str;
int n = 12;
double m[n][n];
double res = 0.0;
double re = 0.0;
double count = 0;
for(int i =0; i < n; i++){
for(int j = 0; j < n; j++){
cin >> m[i][j];
}
}
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
//cout << m[i][j] << endl;
//cout<< m[i][j] << endl;
re = re + m[i][j];
res = re;
}
}
//cout << res << " " << count << endl;
if(str == 'S') res = res;
if(str == 'M') res = res / 66;
//cout<< res << endl;
//float ress = (float)(res);
// cout<< ress << endl;
// printf("%.1f\n", ress);
//cout.unsetf(ios::fixed);
// cout<< res << endl;
// res = res - (abs)(res - (int)(res));
// cout<<(abs)(res - (int)(res)) << endl;
//cout<< res <<endl;
//cout.setf(ios::fixed);
// cout<< res << endl;
printf("%.1lf", res);
return 0;
}
有点乱,希望可以简洁一点