c语言求两个集合的并集然后按照从小到大输出0
heel9074082014.11.07浏览131次分享举报
每组输入数据分为三行,第一行有两个数字n,m(0
输出
针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开。
样例输入
1 2
1
2 3
1 2
1
1 2
我的代码有时候测试正确有时候错误,请问这是为什么
#include
using namespace std;
int cmp(const void*a,const void*b)
{
return(*(int*)a-*(int*)b);
}
int main()
{ const int max=100000;
int temp;
int a,b;int A[max],B[max];
while(cin>>a>>b)
{
for(int d=0;d
cin>>A[d];
for(int j=0;j
cin>>B[j];
temp=0;
for(int y=0;y
{
for(int u=0;u