제출 #232031

#제출 시각아이디문제언어결과실행 시간메모리
232031pere_gil콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" std::string guess_sequence(int N){ string s=""; string re=""; if(press("A")>0){ s="A"; re="BXY"; } if(press("B")>0){ s="B"; re="AXY"; } if(press("X")>0){ s="X"; re="ABY"; } if(press("Y")>0){ s="Y"; re="ABX"; } bool ja; for(int i=0;i<N;i++){ ja=true; if(ja and press(s+re[0])>0){ s+=re[0]; ja=false; } if(ja and press(s+re[1])>0){ s+=re[1]; ja=false; } if(ja and press(s+re[2])>0){ s+=re[2]; ja=false; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:4:5: error: 'string' was not declared in this scope; did you mean 'std::string'?
    4 |     string s="";
      |     ^~~~~~
      |     std::string
In file included from /usr/include/c++/10/string:39,
                 from combo.h:3,
                 from combo.cpp:1:
/usr/include/c++/10/bits/stringfwd.h:79:33: note: 'std::string' declared here
   79 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
combo.cpp:5:11: error: expected ';' before 're'
    5 |     string re="";
      |           ^~~
      |           ;
combo.cpp:7:9: error: 's' was not declared in this scope
    7 |         s="A";
      |         ^
combo.cpp:8:9: error: 're' was not declared in this scope
    8 |         re="BXY";
      |         ^~
combo.cpp:11:9: error: 's' was not declared in this scope
   11 |         s="B";
      |         ^
combo.cpp:12:9: error: 're' was not declared in this scope
   12 |         re="AXY";
      |         ^~
combo.cpp:15:9: error: 's' was not declared in this scope
   15 |         s="X";
      |         ^
combo.cpp:16:9: error: 're' was not declared in this scope
   16 |         re="ABY";
      |         ^~
combo.cpp:19:9: error: 's' was not declared in this scope
   19 |         s="Y";
      |         ^
combo.cpp:20:9: error: 're' was not declared in this scope
   20 |         re="ABX";
      |         ^~
combo.cpp:25:25: error: 's' was not declared in this scope
   25 |         if(ja and press(s+re[0])>0){
      |                         ^
combo.cpp:25:27: error: 're' was not declared in this scope
   25 |         if(ja and press(s+re[0])>0){
      |                           ^~
combo.cpp:29:25: error: 's' was not declared in this scope
   29 |         if(ja and press(s+re[1])>0){
      |                         ^
combo.cpp:29:27: error: 're' was not declared in this scope
   29 |         if(ja and press(s+re[1])>0){
      |                           ^~
combo.cpp:33:25: error: 's' was not declared in this scope
   33 |         if(ja and press(s+re[2])>0){
      |                         ^
combo.cpp:33:27: error: 're' was not declared in this scope
   33 |         if(ja and press(s+re[2])>0){
      |                           ^~
combo.cpp:38:10: error: 's' was not declared in this scope
   38 |   return s;
      |          ^