#include "artclass.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<vector<float>>> v =
{{{190.326, 175.002, 159.736},
{147.793, 137.624, 94.7409},
{188.822, 159.931, 143.647},
{173.119, 148.411, 130.599},
{208.84, 199.867, 197.314},
{229.542, 210.586, 141.902},
{180.461, 174.199, 178.658},
{169.381, 161.819, 156.891},
{220.278, 133.551, 122.694}},
{{130.771, 116.231, 86.0479},
{116.816, 108.484, 68.9826},
{122.273, 86.3923, 46.4901},
{76.5431, 86.4913, 59.5179},
{82.5524, 77.3391, 45.9116},
{111.459, 110.025, 65.8072},
{126.313, 103.379, 76.9841},
{98.2612, 103.548, 58.0462},
{60.6975, 91.1115, 70.2834}},
{{142.306, 134.207, 119.74},
{139.028, 118.037, 85.0788},
{143.453, 139.217, 133.429},
{124.075, 116.275, 102.134},
{131.676, 105.793, 65.2298},
{216.608, 201.341, 156.972},
{114.869, 112.627, 83.4856},
{119.47, 113.515, 98.8594},
{133.838, 115.122, 118.351}},
{{100.719, 110.239, 119.556},
{84.5105, 23.8112, 25.2976},
{217.143, 6.45131, 14.198},
{239.833, 156.83, 89.0304},
{155.378, 76.7555, 39.738},
{195.064, 118.751, 25.1931},
{46.4144, 48.1066, 50.294},
{182.286, 104.388, 75.9469},
{201.685, 162.679, 58.5665}}};
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
float r = 0, g = 0, b = 0;
for (int i=0; i<H; i++){
for (int j=0; j<W; j++){
r += R[i][j];
g += G[i][j];
b += G[i][j];
}
}
r /= (float) H*W;
g /= (float) H*W;
b /= (float) H*W;
float bsf = 100000;
int bo = 0;
for (int i=0; i<4; i++){
for (int j=0; j<9; j++){
float res = pow(r-v[i][j][0], 2) + pow(g-v[i][j][1], 2) + pow(b-v[i][j][2], 2);
if (res < bsf){
bsf = res;
bo = i;
}
}
}
return bo+1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |