제출 #95569

#제출 시각아이디문제언어결과실행 시간메모리
95569shenxy콤보 (IOI18_combo)C++11
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <string> #include <algorithm> using namespace std; string guess_sequence(int N) { string p = ""; for (int i = 1; i <= N; ++i) { p += "A"; int K = press(p); if (K < i) { p.pop_back(); p += "B"; } else continue; int K = press(p); if (K < i) { p.pop_back(); p += "X"; } else continue; int K = press(p); if (K < i) { p.pop_back(); p += "Y"; } else continue; } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:14:13: error: redeclaration of 'int K'
   14 |         int K = press(p);
      |             ^
combo.cpp:9:13: note: 'int K' previously declared here
    9 |         int K = press(p);
      |             ^
combo.cpp:19:13: error: redeclaration of 'int K'
   19 |         int K = press(p);
      |             ^
combo.cpp:9:13: note: 'int K' previously declared here
    9 |         int K = press(p);
      |             ^