제출 #93363

#제출 시각아이디문제언어결과실행 시간메모리
93363temoyanteladze콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
	string s="";
	string v="ABCD";
	if (press("A"))
	{
		s=ch="A";
	}
	if (press("B"))
	{
		s=ch="B";
	}
	if (press("X"))
	{
		s=ch="X";
	}
	if (press("Y"))
	{
		s=ch="Y";
	}
	int k=v.find(ch);
	v.erase(s.begin()+k);
	for (int i=2;i<=n;i++)
    {
    	int p=press(ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2]);
    	if (p==i)
    	s+=v[0];
    	if (p==i+1)
    	s+=v[1];
    	if (p==i-1)
    	s+=v[2];
	}
return s;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:5: error: 'ch' was not declared in this scope
   10 |   s=ch="A";
      |     ^~
combo.cpp:14:5: error: 'ch' was not declared in this scope
   14 |   s=ch="B";
      |     ^~
combo.cpp:18:5: error: 'ch' was not declared in this scope
   18 |   s=ch="X";
      |     ^~
combo.cpp:22:5: error: 'ch' was not declared in this scope
   22 |   s=ch="Y";
      |     ^~
combo.cpp:24:15: error: 'ch' was not declared in this scope
   24 |  int k=v.find(ch);
      |               ^~
combo.cpp:28:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |      int p=press(ans+v[0]+ans+v[1]+v[0]+ans+v[1]+v[1]+ans+v[1]+v[2]);
      |                  ^~~
      |                  abs