#include #include using namespace std; int main() { int m, n; vector a, b; int x, y; cin >> m >> n;// get the num of the two arrays // init the array for (int i = 0; i < m; i++) { int t; cin >> t; a.push_back(t); } for (int i = 0; i < n; i++) { int t; cin >> t; b.push_back(t); } vector t; x = y = 0; while (x < b.size() || y < a.size()) { while (x < a.size() && a[x] < b[y]) x++; while (y < b.size() && b[y] < a[x]) y++; t.push_back(a[x]); } for (int i = 0; i < t.size(); i++) cout << "/t" << t[i]; cout << endl; }
找公共子集
最新推荐文章于 2021-08-15 22:49:52 发布