제출 #1160886

#제출 시각아이디문제언어결과실행 시간메모리
1160886Aza콤보 (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include <string> #include <iostream> #include "combo.h"; #define size(x) (int)x.size() using namespace std; int press(string p){ cout << p << endl; int ret; cin >> ret; return ret; } string guess_sentence(int N){ string s; string g = "ABXY"; char ign = 'A'; for(int i = 0; i < 4; i++){ string h; h += g[i]; if(press(h) == 1){ s += h; ign = g[i]; break; } } string gg; for(char ch:g){ if(ch == ign)continue; gg += ch; } g = gg; while(size(s) != n){ bool did = false; for(int i = 0; i < 2; i++){ s += g[i]; if(press(s) == size(s)){ did = true; break; } s.pop_back(); } if(!did){ s += g[2]; } } return s; } /* */

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

combo.cpp:3:19: warning: extra tokens at end of #include directive
    3 | #include "combo.h";
      |                   ^
combo.cpp: In function 'std::string guess_sentence(int)':
combo.cpp:31:26: error: 'n' was not declared in this scope
   31 |         while(size(s) != n){
      |                          ^