제출 #534446

#제출 시각아이디문제언어결과실행 시간메모리
534446YaserFaisal콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string call( string cur ) { int siz = cur.size()+1 ; if ( cur[0] == 'A' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'B' ) { if ( press(cur+'A') == siz ) return cur+'A' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'Y' ; } if ( cur[0] == 'X' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'A') == siz ) return cur+'A' ; else return cur+'Y' ; } if ( cur[0] == 'Y' ) { if ( press(cur+'B') == siz ) return cur+'B' ; else if ( press(cur+'X') == siz ) return cur+'X' ; else return cur+'A' ; } } string guess_sequence (int n) { string cur = "" ; if ( press(cur+'A') == 1 ) cur+='A' ; else if ( press(cur+'B') == 1 ) cur+='B' ; else if ( press(cur+'X') == 1 ) cur+='X' ; else cur+='Y' ; while(siz<n) cur = call(cur) ; return cur ; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:11: error: 'siz' was not declared in this scope; did you mean 'sin'?
   42 |     while(siz<n) cur = call(cur) ;
      |           ^~~
      |           sin
combo.cpp: In function 'std::string call(std::string)':
combo.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^