제출 #115535

#제출 시각아이디문제언어결과실행 시간메모리
115535suzy콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <string> using namespace std; string guess_sequence(int n) { string s; char c[3]; int k; if(press("A")) s="A"; else if(press("B")) s="B"; else if(press("X")) s="X"; else s="Y"; if(s[0]!='A') c[k++]='A'; if(s[0]!='B') c[k++]='B'; if(s[0]!='X') c[k++]='X'; if(s[0]!='Y') c[k++]='Y'; for(int i=0;i<n-1;i++) s+=c[0]; int pre=press(s); for(int i=1;i<n;i++) { s[i]=c[1]; int cur=press(s); if(pre>cur) s[i]=c[0]; else if(pre<cur) { s[i]=c[1]; pre++; } else { s[i]=c[2]; pre++; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:5: error: 'press' was not declared in this scope
    9 |  if(press("A")) s="A";
      |     ^~~~~
combo.cpp:19:10: error: 'press' was not declared in this scope; did you mean 'pre'?
   19 |  int pre=press(s);
      |          ^~~~~
      |          pre