제출 #534537

#제출 시각아이디문제언어결과실행 시간메모리
534537almothana05콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" using namespace std; string cmp , 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'; } } if(buch == 'A'){ cmp = "BXY"; } else if(buch == 'B'){ cmp = "AXY"; } else if(buch == 'X'){ cmp = "ABY"; } else{ cmp = "ABX"; } int rechner = 0; while(erg.size() < menge - 1 ){ p = ""; erg += cmp[0]; p += erg; erg.pop_back(); erg += cmp[1]; erg += cmp[0]; p += erg; erg.pop_back(); erg += cmp[1]; p += erg; erg.pop_back(); erg += cmp[2]; p += erg; erg.pop_back(); erg.pop_back(); numm = press(p); if(numm == erg.size()){ erg += cmp[2]; } else if(numm - 1 == erg.size()){ erg += cmp[0]; } else{ erg += cmp[1]; } } p = ""; if(erg.size() < menge){ erg += cmp[0]; numm = press(erg); if(numm == erg.size()){ return erg; } erg.pop_back(); erg += cmp[1]; numm = press(erg); if(numm == erg.size()){ return erg; } erg.pop_back(); erg += cmp[2]; numm = press(erg); if(numm == erg.size()){ return erg; } erg.pop_back(); } assert(erg.size() == menge); return erg; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:51:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   51 |   while(erg.size() < menge - 1 ){
      |         ~~~~~~~~~~~^~~~~~~~~~~
combo.cpp:73:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     if(numm == erg.size()){
      |        ~~~~~^~~~~~~~~~~~~
combo.cpp:76:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |     else if(numm - 1 == erg.size()){
      |             ~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:84:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   84 |   if(erg.size() < menge){
      |      ~~~~~~~~~~~^~~~~~~
combo.cpp:87:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   87 |     if(numm == erg.size()){
      |        ~~~~~^~~~~~~~~~~~~
combo.cpp:94:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   94 |     if(numm == erg.size()){
      |        ~~~~~^~~~~~~~~~~~~
combo.cpp:101:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  101 |     if(numm == erg.size()){
      |        ~~~~~^~~~~~~~~~~~~
combo.cpp:106:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  106 |   assert(erg.size() == menge);
      |          ~~~~~~~~~~~^~~~~~~~
combo.cpp:106:3: error: 'assert' was not declared in this scope
  106 |   assert(erg.size() == menge);
      |   ^~~~~~
combo.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "combo.h"
  +++ |+#include <cassert>
    2 | using namespace std;
combo.cpp:50:7: warning: unused variable 'rechner' [-Wunused-variable]
   50 |   int rechner = 0;
      |       ^~~~~~~