제출 #500060

#제출 시각아이디문제언어결과실행 시간메모리
500060LucaIlieCombo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include "combo.h" using namespace std; string guess_sequence( int n ) { int i; string ans; for ( i = 1; i <= n; i++ ) { if ( (i == 1 || ans[0] != 'A') && press( ans + 'A' ) == i ) ans += 'A'; else if ( (i == 1 || ans[0]] != 'B') && press( ans + 'B' ) == i ) ans += 'B'; else if ( (i == 1 || ans[0] != 'X') && press( ans + 'X' ) == i ) ans += 'X'; else ans += 'Y'; } return ans; } int main() { cout << "Hello world!" << endl; return 0; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:36: error: expected ')' before ']' token
   14 |         else if ( (i == 1 || ans[0]] != 'B') && press( ans + 'B' ) == i )
      |                   ~                ^
      |                                    )
combo.cpp:15:23: error: expected ')' before ';' token
   15 |             ans += 'B';
      |                       ^
      |                       )
combo.cpp:14:17: note: to match this '('
   14 |         else if ( (i == 1 || ans[0]] != 'B') && press( ans + 'B' ) == i )
      |                 ^