C++ 编程练习:插入题库难度排序
#include
int main() {
int n, m;
cin >> n >> m;
vector
vector<int> res;
int i = 0, j = 0;
while(i < n && j < m) {
if(t[i] <= d[j]) {
res.push_back(t[i]);
i++;
}
else {
res.push_back(d[j]);
j++;
}
}
while(i < n) {
res.push_back(t[i]);
i++;
}
while(j < m) {
res.push_back(d[j]);
j++;
}
for(int i=0; i<res.size(); i++) {
cout << res[i] << ' '; // 输出空格分隔的结果
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/qmlR 著作权归作者所有。请勿转载和采集!