제출 #933345

#제출 시각아이디문제언어결과실행 시간메모리
933345Quizmos콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> //int press(std::string p); std::string guess_sequence(int N) { std::string p="AB", s=""; char a, b, c; if(press(p)==0) { p="X"; if(press(p)==0) { s+='Y'; a='A'; b='B'; c='X'; } else { s+='X'; a='A'; b='B'; c='Y'; } } else { p="A"; if(press(p)==0) { s+='B'; a='A'; b='X'; c='Y'; } else { s+='A'; a='X'; b='B'; c='Y'; } } for(int i=1; i<N-1; i++) { p=s+a+s+b+a+s+b+b+s+b+c; int coins=press(p); if(coins==s.size()) s+=c; else if(coins==s.size()+1) s+=a; else s+=b; } p=s+a+s+b; if(press(p)==s.size()+1) { p=s+a; if(press(p)==s.size()+1) s+=a; else s+=b; } else s+=c; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press(p)==0)
      |        ^~~~~
combo.cpp:41:19: error: 'press' was not declared in this scope
   41 |         int coins=press(p);
      |                   ^~~~~
combo.cpp:42:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         if(coins==s.size())
      |            ~~~~~^~~~~~~~~~
combo.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         else if(coins==s.size()+1)
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:51:8: error: 'press' was not declared in this scope
   51 |     if(press(p)==s.size()+1)
      |        ^~~~~