제출 #564750

#제출 시각아이디문제언어결과실행 시간메모리
564750MajidQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; //Types using ll = long long; using db = double; //Vectors #define pb push_back #define sz(vec) ((ll)vec.size()) #define all(vec) vec.begin(), vec.end() //things #define f first #define s second const int SMALLINF = 1e9 + 7; const ll BIGINF = ((ll)1e18) + 7; #define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL); int encode(int n, int x, int y){ int num = -1; for(ll i = 0; i < 10; i++){ if((x&(1<<i)) and !(y&(1<<i)))num = i; else if(!(x&(1<<i)) and (y&(1<<i))num2 = i; } if(num!=-1)return num; else return 10+num2; }
#include<bits/stdc++.h> using namespace std; //Types using ll = long long; using db = double; //Vectors #define pb push_back #define sz(vec) ((ll)vec.size()) #define all(vec) vec.begin(), vec.end() //things #define f first #define s second const int SMALLINF = 1e9 + 7; const ll BIGINF = ((ll)1e18) + 7; #define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL); int decode(int n, int q, int h){ if(h<10)return (q&(1<<h)); else return !(q&(1<<h)); }

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

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:27:47: error: expected ';' before 'num2'
   27 |             else if(!(x&(1<<i)) and (y&(1<<i))num2 = i;
      |                                               ^~~~
      |                                               ;
encoder.cpp:27:33: warning: statement has no effect [-Wunused-value]
   27 |             else if(!(x&(1<<i)) and (y&(1<<i))num2 = i;
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~~~
encoder.cpp:28:9: error: expected primary-expression before '}' token
   28 |         }
      |         ^
encoder.cpp:27:56: error: expected ')' before '}' token
   27 |             else if(!(x&(1<<i)) and (y&(1<<i))num2 = i;
      |                    ~                                   ^
      |                                                        )
   28 |         }
      |         ~                                               
encoder.cpp:28:9: error: expected primary-expression before '}' token
   28 |         }
      |         ^
encoder.cpp:31:24: error: 'num2' was not declared in this scope; did you mean 'num'?
   31 |         else return 10+num2;
      |                        ^~~~
      |                        num