没有合适的资源?快使用搜索试试~ 我知道了~
定两个整型数组,本题要求找出不是两者共有的元素.txt
需积分: 47 5 下载量 133 浏览量
2019-12-09
15:13:39
上传
评论 1
收藏 3KB TXT 举报
温馨提示
试读
5页
给定两个整型数组,本题要求找出不是两者共有的元素。 输入格式: 输入分别在两行中给出两个整型数组,每行先给出正整数N(≤20),随后是N个整数,其间以空格分隔。 输出格式: 在一行中按照数字给出的顺序输出不是两数组共有的元素,数字间以空格分隔,但行末不得有多余的空格。题目保证至少存在一个这样的数字。同一数字不重复输出。 输入样例: 10 3 -5 2 8 0 3 5 -15 9 100 11 6 4 8 2 6 -5 9 0 100 8 1 输出样例: 3 5 -15 6 4 1
资源推荐
资源详情
资源评论
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace _3_2สตั้
{
class Program
{
static void Main(string[] args)
{
int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
int count1 = a[0];
int count2 = b[0];
ArrayList a1 = new ArrayList();
ArrayList b1 = new ArrayList();
for (int i = 1; i <= count1; i++)
{
int lag1 = 0;
for (int j = 1; j <= count2; j++)
{
if (a[i] == b[j])
{
lag1 = 1;
break;
}
}
if (lag1 == 0)
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace _3_2สตั้
{
class Program
{
static void Main(string[] args)
{
int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
int count1 = a[0];
int count2 = b[0];
ArrayList a1 = new ArrayList();
ArrayList b1 = new ArrayList();
for (int i = 1; i <= count1; i++)
{
int lag1 = 0;
for (int j = 1; j <= count2; j++)
{
if (a[i] == b[j])
{
lag1 = 1;
break;
}
}
if (lag1 == 0)
资源评论
lllll00000000000
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功