← 查看本卷题目
组合题6 个小题
已作答 0 / 6
1  #include <iostream>2  #include <string>3  #include <vector>45  using namespace std;67  int f(const string &s, const string &t)8  {9      int n = s.length(), m = t.length();1011     vector<int> shift(128, m + 1);1213     int i, j;1415     for (j = 0; j < m; j++)16         shift[t[j]] = m - j;1718     for (i =0; i<= n - m; i += shift[s[i + m]]){19         j =0;20         while(j < m && s[i +j] == t[j]) j++;21         if (j == m) return i;22     }2324     return -1;25 }2627 int main()28 {29     string a ,b;30     cin >> a >> b;31     cout << f(a, b) << endl;32     return 0;33 }

假设输入字符串由 ASCII 可见字符组成,完成下面的判断题和单选题:

判断题

第20题单选题原卷 3 分

f(a, b) 与下列( )语句的功能最类似。

填写答案