제출 #203887

#제출 시각아이디문제언어결과실행 시간메모리
203887V003콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { char c[4]={'A', 'B', 'X', 'Y'}; string s; int x; if(press("AB">=1)) x=press("A")!=1; else x=2+press("X")<1; s+=c[x]; if(n==1) return s; swap(c[x]. c[3]); for(int i=1; i<n-1; i++) { x=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[0]+c[2]+s+c[1]); if(x==i+1) s+=c[1]; if(x==i+2) s+=c[0]; if(x==i) s+=c[2]; } if(press(s+c[0]+s+c[1])==n) { if(press(s+c[0])) s+=c[0]; else s+=c[1]; } else s+=c[2]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if(press("AB">=1)) x=press("A")!=1;
      |              ~~~~^~~
combo.cpp:9:18: error: could not convert '(((const char*)"AB") >= ((const char*)1))' from 'bool' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
combo.cpp:14:16: error: request for member 'c' in 'c[x]', which is of non-class type 'char'
   14 |     swap(c[x]. c[3]);
      |                ^