2019-05-17
09:37:46
加油,加油 !!!
结果要从小到大输出
NULL后面没有空格
m && n == 0才结束
注意:看题仔细,罚时很严重
#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main()
{
int n, m;
int i, j;
int x;
while(~scanf("%d %d", &n, &m))
{
if (n == && m == )
{
return ;
}
a.clear();
for (i = ; i < n; i++)
{
scanf ("%d", &x);
a.push_back(x);
}
for (j = ; j < m; j++)
{
scanf("%d", &x);
if(find(a.begin(), a.end(), x) != a.end())
{
a.erase(find(a.begin(), a.end(), x));
}
}
if(a.empty())
{
cout << "NULL" << endl;
continue;
}
sort(a.begin(),a.end());
for(i = ; i < a.size(); i++)
{
cout << a[i] << " ";
}
cout << endl;
}
return ;
}