제출 #220619

#제출 시각아이디문제언어결과실행 시간메모리
220619Coroian_David콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N) { using namespace std; string s; s.clear(); char ch[4] = {'A', 'B', 'X', 'Y'}; int poz = 0; int x = press("AB"); cout << "INTREB AB REZ = " << x << "\n"; if(x >= 1) { int y = press("A"); poz = (y == 1 ? 0 : 1); } else { int y = press("X"); poz = (y == 1 ? 2 : 3); } swap(ch[0], ch[poz]); s.resize(1); s[0] = ch[0]; string a; a.clear(); for(int i = 1; i < N - 1; i ++) { a = s + ch[2] + s + ch[3] + ch[1] + s + ch[3] + ch[2] + s + ch[3] + ch[3]; int x = press(a) - i; s.resize(i + 1); s[i] = ch[1 + x]; } x = press(s + ch[1] + s + ch[2]); if(x == N) { int y = press(s + ch[1]); s.resize(N); s[N - 1] = (y == N ? ch[1] : ch[2]); } else { s.resize(N); s[N - 1] = ch[3]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:5: error: 'cout' was not declared in this scope
   13 |     cout << "INTREB AB  REZ = " << x << "\n";
      |     ^~~~
combo.cpp:2:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include "combo.h"
  +++ |+#include <iostream>
    2 |