제출 #127859

#제출 시각아이디문제언어결과실행 시간메모리
127859super_j6Combo (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> using namespace std; #define endl '\n' string s = ""; char c[4] = {'A', 'B', 'X', 'Y'}; int bad = 4; char r(int x){ return c[x + (x >= bad)]; } void find1(){ if(press(s + r(0) + s + r(1)) > 0){ if(press(s + r(0))){ s += r(0); bad = 0; }else{ s += r(1); bad = 1; } }else{ if(press(s + r(2))){ s += r(2); bad = 2; }else{ s += r(3); bad = 3; } } } void find2(){ int x = press(s + r(1) + s + r(2) + r(0) + s + r(2) + r(1) + s + r(2) + r(2)); if(x == 0){ s += r(0); }else if(x == 1){ s += r(1); }else{ s += r(2); } } string guess_sequence(int n){ int n; cin >> n; for(int i = 0; i < n; i++){ if(i == 0 || i == n - 1) find1(); else find2(); } return s; }

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

combo.cpp: In function 'void find1()':
combo.cpp:17:5: error: 'press' was not declared in this scope
   17 |  if(press(s + r(0) + s + r(1)) > 0){
      |     ^~~~~
combo.cpp: In function 'void find2()':
combo.cpp:37:10: error: 'press' was not declared in this scope
   37 |  int x = press(s + r(1) + s + r(2) + r(0) + s + r(2) + r(1) + s + r(2) + r(2));
      |          ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:6: error: declaration of 'int n' shadows a parameter
   49 |  int n;
      |      ^
combo.cpp:48:27: note: 'int n' previously declared here
   48 | string guess_sequence(int n){
      |                       ~~~~^