제출 #123053

#제출 시각아이디문제언어결과실행 시간메모리
123053khulegub콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string butt[] = {"A", "B", "X", "Y"}; string guess_sequence(int N) { int f; string S = ""; if(press("A")) f = 0; else if(press("B")) f = 1; else if(press("X")) f = 2; else f = 3; S = butt[f]; string asky = s + butt[(f + 1) % 4] asky += s + butt[(f + 2) % 4] + butt[(f + 1) % 4]; asky += s + butt[(f + 2) % 4] + butt[(f + 2) % 4]; asky += s + butt[(f + 2) % 4] + butt[(f + 3) % 4]; for (int i = 1; i < N; i++){ int x = press(asky); int nxt; if (x == S.length() + 1) nxt = (f + 1) % 4; else if (x == S.length() + 2) nxt = (f + 2) % 4; else if (x == S.length() ) nxt = (f + 3) % 4; S += butt[nxt]; } return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:17:16: error: 's' was not declared in this scope
   17 |  string asky = s + butt[(f + 1) % 4]
      |                ^
combo.cpp:24:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   if (x == S.length() + 1) nxt = (f + 1) % 4;
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:25:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   else if (x == S.length() + 2) nxt = (f + 2) % 4;
      |            ~~^~~~~~~~~~~~~~~~~
combo.cpp:26:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   else if (x == S.length() ) nxt = (f + 3) % 4;
      |            ~~^~~~~~~~~~~~~