제출 #200452

#제출 시각아이디문제언어결과실행 시간메모리
200452mohamedsobhi777Martian DNA (IOI16_dna)C++14
컴파일 에러
0 ms0 KiB
#include "dna.h" #include <cstdlib> std::string analyse(int n, int t) { string ret = ""; for(int i = 0;i<(1<<n);i++) { string st; for(int j = 0;j<5;j++) { st+=char( (i>>j) + '0'); } if( make_test(st) ==n ) { return st; } } }

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

dna.cpp: In function 'std::__cxx11::string analyse(int, int)':
dna.cpp:8:5: error: 'string' was not declared in this scope
     string ret = "";
     ^~~~~~
dna.cpp:8:5: note: suggested alternatives:
In file included from /usr/include/c++/7/string:39:0,
                 from dna.h:3,
                 from dna.cpp:1:
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
   typedef basic_string<char>    string;
                                 ^~~~~~
/usr/include/c++/7/bits/stringfwd.h:74:33: note:   'std::__cxx11::string'
dna.cpp:11:16: error: expected ';' before 'st'
         string st;
                ^~
dna.cpp:14:13: error: 'st' was not declared in this scope
             st+=char(  (i>>j) + '0');
             ^~
dna.cpp:14:13: note: suggested alternative: 't'
             st+=char(  (i>>j) + '0');
             ^~
             t
dna.cpp:16:23: error: 'st' was not declared in this scope
         if( make_test(st) ==n )
                       ^~
dna.cpp:16:23: note: suggested alternative: 't'
         if( make_test(st) ==n )
                       ^~
                       t
grader.cpp: In function 'bool make_test(std::__cxx11::string)':
grader.cpp:14:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < p.size(); i++) {
                  ~~^~~~~~~~~~
grader.cpp:23:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i <= ss.size(); i++) {
                  ~~^~~~~~~~~~~~
grader.cpp:28:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (pr[i] == p.size()) {