제출 #92967

#제출 시각아이디문제언어결과실행 시간메모리
92967beso123콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string a="ABXY"; string guess_sequence(int N){ string s; for(int k=0;k<a.size();k++) if(press(a[k])==1){ s+=a[k]; break; } for(int k=0;k<a.size();k++){ string b=s+a[k]; if(press(b)==2){ s=b; break; } } for(int k=0;k<a.size();k++){ string b=s+a[k]; if(press(b)==3){ s=b; break; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:8:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | for(int k=0;k<a.size();k++)
      |             ~^~~~~~~~~
combo.cpp:9:14: error: could not convert 'a.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)k))' from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
    9 | if(press(a[k])==1){
      |              ^
      |              |
      |              __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
combo.cpp:13:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | for(int k=0;k<a.size();k++){
      |             ~^~~~~~~~~
combo.cpp:20:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | for(int k=0;k<a.size();k++){
      |             ~^~~~~~~~~