제출 #1142057

#제출 시각아이디문제언어결과실행 시간메모리
1142057joker콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <unordered_set> #include <unordered_map> #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <iomanip> #include <numeric> using namespace std; std::string guess_sequence(int N) { string S = ""; vector<char> btns = {'X','Y','B','A'}; int frstidx = -1; while (S.length() != N) { if (S.lenght() == 0) { for (let i = 0; i < 4; i++) { string st; st += btns[i]; int coin = press(st); if (coin == 1) { frstidx = i; S += btns[i]; break; } } } else { for (size_t i = 0; i < 4; i++) { if (i != frstidx) { string st = S+btns[i]; int coin = press(st); if (coin == S.length()+1) { S += btns[i]; break; } } } } } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:18:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenght'; did you mean 'length'?
   18 |     if (S.lenght() == 0) {
      |           ^~~~~~
      |           length
combo.cpp:19:14: error: 'let' was not declared in this scope
   19 |         for (let i = 0; i < 4; i++) {
      |              ^~~
combo.cpp:19:25: error: 'i' was not declared in this scope
   19 |         for (let i = 0; i < 4; i++) {
      |                         ^