請管理員看一下
很單純的程式碼,怎會 SE
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int n,nn, i,R,G,B;
double X,Y,Z,sum;
while(cin >> n)
{
nn=n*n; sum=0;
for(i=0;i<nn;i++)
{
cin >> R >> G >> B;
X = 0.5149 * R + 0.3244 * G + 0.1607 * B ;
Y = 0.2654 * R + 0.6704 * G + 0.0642 * B ;
Z = 0.0248 * R + 0.1248 * G + 0.8504 * B ;
sum += Y;
cout << fixed << setprecision(4) << X << " " << Y << " " << Z << endl;
}
cout << "The average of Y is " << sum/nn << endl;
}
return 0;
}