제출 #1283783

#제출 시각아이디문제언어결과실행 시간메모리
1283783m.zeeshanrashidCombo (IOI18_combo)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ int n; cin>>n; string s; if(press("AB")){ if(press("A")) s="A"; else s="B"; } else{ if(press("X")==1) s="X"; else s="Y"; } string a="ABXY"; for(int i=0;i<4;i++){ if(s[0]==a[i]){ a.erase(begin(a)+i); break; } } int len=1; while(len<n-1){ string q=s+a[0]; for(int i=0;i<3;i++) q+=s+a[1]+a[i]; int g=press(q); if(g==len) s+=a[2]; if(g==len+1) s+=a[0]; if(g==len+2) s+=a[1]; len++; } if(press(s+a[0]+s+a[1])==len+1){ if(press(s+a[0])==len+1) s+=a[0]; else s+=a[1]; } else s+=a[2]; // cout<<s<<endl; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:13: error: declaration of 'int n' shadows a parameter
    6 |         int n;
      |             ^
combo.cpp:5:27: note: 'int n' previously declared here
    5 | string guess_sequence(int n){
      |                       ~~~~^