제출 #1185546

#제출 시각아이디문제언어결과실행 시간메모리
1185546eri16콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h" using namespace std; string solve(string x,string y,string z, string k,int N){ int sz=k.size(); string temp=k+x+x+k+x+y+k+x+z+k+y; if (sz!=N-1){ if (press(temp)==sz){ k+=z; } if (press(temp)==sz+1){ k+=y; } if (press(temp)==sz+2){ k+=x; } return solve(x,y,z,k,N); } if (sz==N-1){ string temp=k+x; if (press(check)==N){ return (temp); } string temp=k+y; if (press(check)==N){ return (temp); } else{ return (k+z); } } } string guess_sequence(int N) { string p = ""; string check = ""; string ans; check += "ab"; if (press(check)>=1){ check.clear(); check+="a"; if (press(check)==1){ ans=solve ("x","y","b","a",N); } if (press(check)==0){ ans=solve ("x","y","a","b",N); } } if (press(check)==0){ check.clear(); check+="x"; if (press(check)==1){ ans=solve ("b","y","a","x",N); } if (press(check)==0){ ans=solve ("x","b","a","y",N); } } return ans; }

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

combo.cpp: In function 'std::string solve(std::string, std::string, std::string, std::string, int)':
combo.cpp:31:13: error: 'check' was not declared in this scope
   31 |   if (press(check)==N){
      |             ^~~~~
combo.cpp:35:12: error: redeclaration of 'std::string temp'
   35 |     string temp=k+y;
      |            ^~~~
combo.cpp:29:12: note: 'std::string temp' previously declared here
   29 |     string temp=k+x;
      |            ^~~~
combo.cpp:36:13: error: 'check' was not declared in this scope
   36 |   if (press(check)==N){
      |             ^~~~~
combo.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^