제출 #203880

#제출 시각아이디문제언어결과실행 시간메모리
203880V003콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <combo.h> using namespace std; string guess_sequence(int n) { char a, b, c, d; string s=""; int k=press("AB"); if(k) { k=press("A"); if(k){ a='A'; b='B'; c='X'; d='Y'; } else { a='B'; b='A'; c='X'; d='Y'; } } else { k=press("Y"); if(k) { a='Y'; b='B'; c='X'; d='A'; } else { a='X'; b='B'; c='A'; d='Y'; } } s+=a; int l=1; while(l<n) { k=press(s+b+s+c+c+s+c+b+s+c+d); if(k==l) s+=d; if(k==l+1) s+=b; if(k==l+2) s+=c; l++; } return s; } int main() { string s; cin>>s; n=s.size(); cout<<guess_sequence(n); }

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

combo.cpp: In function 'int main()':
combo.cpp:61:5: error: 'cin' was not declared in this scope
   61 |     cin>>s;
      |     ^~~
combo.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include <combo.h>
  +++ |+#include <iostream>
    2 | using namespace std;
combo.cpp:62:5: error: 'n' was not declared in this scope
   62 |     n=s.size();
      |     ^
combo.cpp:63:5: error: 'cout' was not declared in this scope
   63 |     cout<<guess_sequence(n);
      |     ^~~~
combo.cpp:63:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?