제출 #963831

#제출 시각아이디문제언어결과실행 시간메모리
963831Hezov콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = "";///Empty string. ///Find first character. if(press("AB")) { if(press("A")) s+="A"; else s+="B"; } else { if(press("X")) s+="X"; else s+="Y"; } ///First character found. char choices[3]; int poz = 0; if(s[0]!='A') choices[poz++] = 'A'; if(s[0]!='B') choices[poz++] = 'B'; if(s[0]!='X') choices[poz++] = 'C'; if(s[0]!='Y') choices[poz++] = 'Y'; ///Now we have all the choices. for(int i = 2;i<N;i++) { string p=""; ///sA sBA p =s + choices[0] + s + choices[1] + choices[0]; /// sBB p = s + choices[1] + s + choices[1]; /// sBC p = s + choices[1] + choices[2]; if(press(p)==i) s+=choices[0]; else if(press(p)==i+1) s+=choices[1]; else s+=choices[2]; } ///Now we need the last letter. if(press(s+choices[0])==N) s+=choices[0]; else if(press+choices[1])==N) s+=choices[1]; else s+=choices[2]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:49:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   49 |     else if(press+choices[1])==N)
      |             ~~~~~^~~~~~~~~~~
combo.cpp:49:30: error: expected primary-expression before '==' token
   49 |     else if(press+choices[1])==N)
      |                              ^~