제출 #937010

#제출 시각아이디문제언어결과실행 시간메모리
937010Yazan_SA콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include<combo.h> using namespace std; //int press(string p) //{ // //} string guess_sequence(int N) { string ans=""; string bts="ABXY"; int mx=0,mxp=0; while(mx!=N) { if(ans!="" && (int)bts.size()==4) { bts.erase(bts.begin()+bts.find(ans[0])); } mx=press(ans+bts[0]+ans+bts[1]); if(mx>mxp) { if(mxp != press(ans+bts[0]))ans+=bts[0]; else ans+=bts[1]; } } else if(ans=="") { if(mxp+1==press(ans+bts[2]))ans+=bts[2]; else ans+=bts[3]; } else ans+=bts[2]; mxp=ans.size(); } return ans; } //int main() //{ // string s="abcd"; // s.erase(s.begin()+s.find('a')); // cout<<s; //}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:9: error: 'else' without a previous 'if'
   26 |         else if(ans=="")
      |         ^~~~
combo.cpp:33:5: warning: no return statement in function returning non-void [-Wreturn-type]
   33 |     }
      |     ^
combo.cpp: At global scope:
combo.cpp:34:5: error: expected unqualified-id before 'return'
   34 |     return ans;
      |     ^~~~~~
combo.cpp:35:1: error: expected declaration before '}' token
   35 | }
      | ^