제출 #107241

#제출 시각아이디문제언어결과실행 시간메모리
107241wonyoung콤보 (IOI18_combo)C++14
10 / 100
77 ms436 KiB
#include <iostream> #include <string> using namespace std; int press(string p); string guess_sequence(int N) { const char buttons[4] = { 'A', 'B', 'X', 'Y' }; string s = ""; int i; while (s.length() < N) { for (i=0; i<3; i++) { if (s.length() > 0 && s[0] == buttons[i]) continue; string query_string = ""; query_string.append(s); query_string.push_back(buttons[i]); int n = press(query_string); if (n > s.length()) { break; } } s.push_back(buttons[i]); } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |     while (s.length() < N)
      |            ~~~~~~~~~~~^~~
combo.cpp:21:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if (n > s.length())
      |                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...