제출 #385839

#제출 시각아이디문제언어결과실행 시간메모리
385839ismoilov콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
 
string guess_sequence(int n) {
	string s, c = "ABXY";
	int f, x;
	f = press("AB");
	if(f > 0)
	{
		x = press("A");
		if(x > 0)
			s = "A";
		else
			s = "B";
	}
	else
	{
		x = press("X");
		if(x > 0)
			s = "X";
		else
			s = "Y";
	}
	f = 1;
	c.erase(c.find(s), 1)
	for(int i = 1; i < n-1; i ++)
	{
		//cout << f << " " << s << " // ";
		string v = s + c[1] + s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2];
		x = press(v);
		if(x == f)
		{
			s += c[2];
			f = x + 1;
			continue;
		}
		if(x - f == 1)
		{
			s += c[1];
			f = x;
			continue;
		}
		s += c[0];
		f = x-1;
	}
	x = press(s + c[0]);
	if(x == n)
		return s+c[0];
	x = press(s + c[1]);
	if(x == n)
		return s+c[1];
	return s+c[2];
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:23: error: expected ';' before 'for'
   26 |  c.erase(c.find(s), 1)
      |                       ^
      |                       ;
   27 |  for(int i = 1; i < n-1; i ++)
      |  ~~~                   
combo.cpp:27:17: error: 'i' was not declared in this scope
   27 |  for(int i = 1; i < n-1; i ++)
      |                 ^