제출 #770228

#제출 시각아이디문제언어결과실행 시간메모리
770228boyliguanhan콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { std::string str; int res; char a,b,c; if(press("AB")) if(press("A")) str="A",a='B',b='X',c='Y'; else str="B",a='A',b='X',c='Y'; else if(press("X")) str = "X",a='Y',b='A',c='B'; else str = "Y",a='X',b='A',c='B'; if(n==a) return res; for(int i = 1; i < N-1; i++) { res = press(str+a+str+b+a+str+b+b+str+b+c); if(res==i) str+=c; if(res==i+1) str+=a; if(res==i+2) str+=b; } if(press(str+a)==N) str+=a; else if(press(str+b)==N) str+=b; else str+=c; return str; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:8: error: 'n' was not declared in this scope
   17 |     if(n==a) return res;
      |        ^
combo.cpp:17:21: error: could not convert 'res' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   17 |     if(n==a) return res;
      |                     ^~~
      |                     |
      |                     int