제출 #767982

#제출 시각아이디문제언어결과실행 시간메모리
767982Ahmed57Art Class (IOI13_artclass)C++17
컴파일 에러
0 ms0 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; int style(int H,int W, int R[500][500],int G[500][500],int B[500][500]){ for(int i = 0;i<H;i++){ for(int j = 1;j<W;j++){ all+=abs(R[i][j]-R[i][j-1]); all+=abs(G[i][j]-G[i][j-1]); all+=abs(B[i][j]-B[i][j-1]); } } if(all<10)return 4; else if(all<=30)return 3 else if(all<=50)return 2; else return 1; }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:9:13: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
    9 |             all+=abs(R[i][j]-R[i][j-1]);
      |             ^~~
      |             std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from artclass.cpp:2:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
artclass.cpp:14:8: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   14 |     if(all<10)return 4;
      |        ^~~
      |        std::filesystem::perms::all
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from artclass.cpp:2:
/usr/include/c++/10/bits/fs_fwd.h:148:7: note: 'std::filesystem::perms::all' declared here
  148 |       all  =  0777,
      |       ^~~
artclass.cpp:15:29: error: expected ';' before 'else'
   15 |     else if(all<=30)return 3
      |                             ^
      |                             ;
   16 |     else if(all<=50)return 2;
      |     ~~~~                     
artclass.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^