제출 #564836

#제출 시각아이디문제언어결과실행 시간메모리
564836Uzouf질문 (CEOI14_question_grader)C++14
컴파일 에러
0 ms0 KiB
int encode(int n,int x,int y) { int a=x,b=y; for (int p=10;p>=0;p--) { int i=0,j=0; if (exp2(p)<=a) { a-=exp2(p); i=1; } if (exp2(p)<=b) { b-=exp2(p); j=1; } if (i>j) return p; } a=__builtin_popcount(x); b=__builtin_popcount(y); for (int p=5;p>=0;p--) { int i=0,j=0; if (exp2(p)<=a) { a-=exp2(p); i=1; } if (exp2(p)<=b) { b-=exp2(p); j=1; } if (i<j) return p+10; } }
int decode(int n,int q,int h) { if (h>10) { h-=10; int nm=__builtin_popcount(q); int k=nm; for (int p=5;p>=0;p--) { int i=0; if (exp2(p)<=k) { k-=exp2(p); i=1; } if (p==h) { if (i==1) return 1; else return 0; } } } else { int k=q; for (int p=10;p>=0;p--) { int i=0; if (exp2(p)<=k) { k-=exp2(p); i=1; } if (p==h) { if (i==0) return 1; else return 0; } } } }

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

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:5:11: error: 'exp2' was not declared in this scope
    5 |       if (exp2(p)<=a) {
      |           ^~~~
encoder.cpp:8:11: error: 'exp2' was not declared in this scope
    8 |       if (exp2(p)<=b) {
      |           ^~~~
encoder.cpp:18:11: error: 'exp2' was not declared in this scope
   18 |       if (exp2(p)<=a) {
      |           ^~~~
encoder.cpp:21:11: error: 'exp2' was not declared in this scope
   21 |       if (exp2(p)<=b) {
      |           ^~~~
encoder.cpp:26:2: warning: control reaches end of non-void function [-Wreturn-type]
   26 |  }
      |  ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:8:11: error: 'exp2' was not declared in this scope
    8 |       if (exp2(p)<=k) {
      |           ^~~~
decoder.cpp:21:11: error: 'exp2' was not declared in this scope
   21 |       if (exp2(p)<=k) {
      |           ^~~~
decoder.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^