W3School TIY Editor

  • W3School 在线教程
  • 改变方向
  • 暗黑模式
​x
 
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
​
int main() {
  vector<int> numbers = {1, 7, 3, 5, 9, 2};
  vector<int> target = {3, 5, 9};
​
  if (search(numbers.begin(), numbers.end(), target.begin(), target.end()) != numbers.end()) {
    cout << "找到目标序列";
  } else {
    cout << "未找到目标序列";
  }
  return 0;
}