Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135090 徐英杰 字符串包含判断 C++ Compile Error 0 MS 0 KB 635 2025-11-02 15:22:26

Tests(0/0):


Code:

bool OJ1467(string a, string b) { // 如果b是空字符串,则总是返回true if (b.empty()) return true; // 如果a比b短,则不可能包含b if (a.size() < b.size()) return false; for (int i = 0; i <= a.size() - b.size(); i++) { if (b[0] == a[i]) { bool match = true; for (int j = 0; j < b.size(); j++) { if (b[j] != a[i + j]) { match = false; break; } } if (match) { return true; } } } return false; }


Run Info:

Main.cc:1:13: error: 'string' was not declared in this scope
 bool OJ1467(string a, string b) {
             ^
Main.cc:1:23: error: 'string' was not declared in this scope
 bool OJ1467(string a, string b) {
                       ^
Main.cc:1:31: error: expression list treated as compound expression in initializer [-fpermissive]
 bool OJ1467(string a, string b) {
                               ^
Main.cc:1:33: error: expected ',' or ';' before '{' token
 bool OJ1467(string a, string b) {
                                 ^