c语言 集合a-b#include #include int cmp(const int *a,const int *b){return *a - *b;}int main(void){int n,m,i,j;int s[101];while (scanf("%d%d",&n,&m),m+n){for (i = 0; i < n; i++)scanf("%d",s + i);for (i = 0; i < m; i++){scanf("%d",s + n);for (j = 0;
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 13:05:52
c语言 集合a-b#include #include int cmp(const int *a,const int *b){return *a - *b;}int main(void){int n,m,i,j;int s[101];while (scanf("%d%d",&n,&m),m+n){for (i = 0; i < n; i++)scanf("%d",s + i);for (i = 0; i < m; i++){scanf("%d",s + n);for (j = 0;
c语言 集合a-b
#include
#include
int cmp(const int *a,const int *b)
{
return *a - *b;
}
int main(void)
{
int n,m,i,j;
int s[101];
while (scanf("%d%d",&n,&m),m+n)
{
for (i = 0; i < n; i++)
scanf("%d",s + i);
for (i = 0; i < m; i++)
{
scanf("%d",s + n);
for (j = 0; s[j] = s[n]; j++);
if (j = n) s[j] = s[--n];
}
qsort(s,n,sizeof(int),cmp);
for (i = 0; i < n; i++)
printf("%d ",s[i]);
printf(n "\n" :"NULL\n");
}
return 0;
}
Input
每组输入数据占1行,每行数据的开始是2个整数n(0
c语言 集合a-b#include #include int cmp(const int *a,const int *b){return *a - *b;}int main(void){int n,m,i,j;int s[101];while (scanf("%d%d",&n,&m),m+n){for (i = 0; i < n; i++)scanf("%d",s + i);for (i = 0; i < m; i++){scanf("%d",s + n);for (j = 0;
std::set a;std::set b;
std::set c = a-b;