제출 #534489

#제출 시각아이디문제언어결과실행 시간메모리
534489almothana05콤보 (IOI18_combo)C++14
30 / 100
61 ms304 KiB
#include "combo.h" using namespace std; string cmp = "ABXY" , erg = "" ; int numm = 0 , nummer = 0; char buch; string guess_sequence(int menge) { string p = ""; p = "AB"; numm = press(p); if(numm == 2){ erg = p; buch = 'A'; } else if(numm > 0){ p = 'A'; numm = press(p); if(numm == 1){ erg += 'A'; buch = 'A'; } else{ erg += 'B'; buch = 'B'; } } else{ p = 'X'; numm = press(p); if(numm == 1){ erg += 'X'; buch = 'X'; } else{ erg += 'Y'; buch = 'Y'; } } int rechner = 0; while(erg.size() < menge){ rechner = 0; for(int i = 0 ; i < cmp.size() ; i++){ if(cmp[i] != buch){ erg += cmp[i]; if(rechner == 2){ break; } numm = press(erg); rechner++; if(numm == erg.size()){ break; } erg.pop_back(); } } } return erg; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |   while(erg.size() < menge){
      |         ~~~~~~~~~~~^~~~~~~
combo.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0 ; i < cmp.size() ; i++){
      |                     ~~^~~~~~~~~~~~
combo.cpp:49:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         if(numm == erg.size()){
      |            ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...