제출 #823529

#제출 시각아이디문제언어결과실행 시간메모리
823529handlewastaken콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <string> using namespace std; string guess_sequence(int N) { string s, t; int i, er = press("AB"), se = press("AX"); if (er > 0) { if (se > 0) t = "ABXY"; else t = "BXYA"; } else { if (se > 0) t = "XYAB"; else t = "YABX"; } s = t[0]; if (n == 1) return s; for (i = 2; i < n; i++) { er = press(s + t[1] + s + t[2] + t[1] + s + t[2] + t[2] + s + t[2] + t[3]); if (er == i) s += t[1]; else if (er == i + 1) s += t[2]; else s += t[3]; } er = press(s + t[1]); se = press(s + t[2]); if (er == n) s += t[1]; else if (se == n) s += t[2]; else s += t[3]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:9: error: 'n' was not declared in this scope
   23 |     if (n == 1)
      |         ^
combo.cpp:25:21: error: 'n' was not declared in this scope
   25 |     for (i = 2; i < n; i++)
      |                     ^
combo.cpp:37:15: error: 'n' was not declared in this scope
   37 |     if (er == n)
      |               ^