中国能源消费结构与空气质量关系的研究,数学建模论文,原创。
#include <vector> using namespace std;
const int MAXN = 10;//每个变量的数据量
const int MAXM = 5;//变量个数(母序列为第0列) const double p = 0.5;//分辨系数,常数
double mat[MAXM][MAXN]; double k[MAXM][MAXN]; double y[MAXM][MAXN]; double a = 9999999.0, b = 0.0; int main() { freopen("data.txt", "r", stdin); freopen("out.txt", "w", stdout); memset(mat, 0, sizeof(mat)); memset(y, 0, sizeof(y)); memset(k, 0, sizeof(k)); for (int i=0; i<MAXN; i++) scanf("%lf", &mat[0][i]); for (int i=0; i<MAXN; i++) { for (int j=1; j<5; j++) { scanf("%lf", &mat[j][i]); k[j][i] = abs(mat[j][i] - mat[0][i]); if (a > k[j][i]) a = k[j][i]; if (b < k[j][i]) b = k[j][i]; } } for (int j=1; j<MAXM; j++) { double r = 0.0; for (int i=0; i<MAXN; i++) { y[j][i] = (a + b * p) / (k[j][i] + b * p); r += y[j][i]; } printf("%lf\n", r/MAXN); } return 0; }