제출 #1142667

#제출 시각아이디문제언어결과실행 시간메모리
1142667younesb2Combo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include <bits/stdc++.h>

using namespace std;

string guess_sequence(int n) {
    string a="";
    int b=0;
    vector <char> c={'A','B','X','Y'};
    for(int i=0;i<n;i++) {
        for(const auto& i : c) {
            a.push_back(i);
            int i=press(a);
            if(i-b==1) {
                b++;
                break;
            }
            a.pop_back();
        }
    }
    return a;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:13:17: error: redeclaration of 'int i'
   13 |             int i=press(a);
      |                 ^
combo.cpp:11:25: note: 'const char& i' previously declared here
   11 |         for(const auto& i : c) {
      |                         ^