Advertisement
Emiliatan

b056

Jun 16th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. /* b056            */
  2. /* AC (0.1s, 25MB) */
  3. #include <cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int n, r, g, b;
  8. double x, y, z, ys;
  9.  
  10. int main()
  11. {
  12.     while(~scanf("%d", &n))
  13.     {
  14.         ys = 0.0;
  15.         for(int i = 0; i < n; ++i)
  16.             for(int j = 0; j < n; ++j)
  17.             {
  18.                 scanf("%d %d %d", &r, &g, &b);
  19.                 x = 0.5149 * r + 0.3244 * g + 0.1607 * b;
  20.                 y = 0.2654 * r + 0.6704 * g + 0.0642 * b;
  21.                 z = 0.0248 * r + 0.1248 * g + 0.8504 * b;
  22.                 ys += y;
  23.                 printf("%.4f %.4f %.4f\n", x, y, z);
  24.             }
  25.         printf("The average of Y is %.4f\n", ys / (n * n));
  26.     }
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement