제출 #396423

#제출 시각아이디문제언어결과실행 시간메모리
396423wmrmr미술 수업 (IOI13_artclass)C++17
컴파일 에러
0 ms0 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; const int MAX = 500; int r[MAX][MAX], g[MAX][MAX], b[MAX][MAX]; int MOD(int x) { if(x>0) return x; return -x; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int style4 = 0; for(int i=0;i<H;i++) { int cnt,sR,sG,sB; cnt = sR = sG = sB = 0; float w = W; for(int j=0;j<W;j++) { sR += R[i][j]; sG += G[i][j]; sB += B[i][j]; } int aR = sR/W, aG = sG/W, aB = sB/W; for(int j=0;j<W;j++) { if( MOD(R[i][j]-aR) <= 10 && MOD(G[i][j]-aG) <= 10 && MOD(B[i][j]-aB) <= 10 ) cnt++; } float ind = cnt; if(ind < w*0.7) continue; style4++; } if(style4>h/2) return 4; int cntW = 0; for(int i=0;i<H;i++) for(int j=0;j<W;j++) { if(R[i][j] <= 20 && G[i][j] <= 20 && B[i][j] <= 20) cntW++; } if(cntW >= H*W/5) return 1; srand(time(0)); return (rand()%2) ? 2 : 3; } //int main() //{ // int n,m; scanf("%d %d",&n,&m); // for(int i=0;i<n;i++) for(int j=0;j<m;j++) scanf("%d %d %d",&r[i][j],&g[i][j],&b[i][j]); // printf("%d\n",style(n,m,r,g,b)); //}

컴파일 시 표준 에러 (stderr) 메시지

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:35:12: error: 'h' was not declared in this scope
   35 |  if(style4>h/2) return 4;
      |            ^