제출 #644548

#제출 시각아이디문제언어결과실행 시간메모리
644548tigar콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string rezz=""; char slova[]={'A', 'B', 'X', 'Y'}; int begg=0; int br=press("AB"); if(br>=1) { br=press("A"); if(br==1){rezz+="A"; begg=0;} else {rezz+="B"; begg=1;} } else if(br==0) { br=press("X"); if(br==1){rezz+="X"; begg=2;} else {rezz+="Y"; begg=3;} } for(int i=1; i<=N-1; i++) { string prs=rezz+slova[(begg+1)%4]+slova[(begg+1)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+2)%4]; prs+=rezz+slova[(begg+1)%4]+slova[(begg+3)%4]; prs+=rezz+slova[(begg+2)%4]; int lnght=press(prs); if(lnght==i+2)rezz+=slova[(begg+1)%4]; else if(lnght==i+1)rezz+=slova[(begg+2)%4]; else rezz+=slova[(begg+3)%4]; } int num=press(rezz+slova[(begg+1)%4]+rezz+slova[(begg+2)%4]) if(num==N-1)rezz+slova[(begg+3)%4]; else { num=press(rezz+slova[(begg+1)%4]); if(num==N-1)rezz+slova[(begg+2)%4]; else rezz+slova[(begg+1)%4]; } return rezz; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:37:5: error: expected ',' or ';' before 'if'
   37 |     if(num==N-1)rezz+slova[(begg+3)%4];
      |     ^~
combo.cpp:38:5: error: 'else' without a previous 'if'
   38 |     else
      |     ^~~~