第十六周项目——oj2
来源:互联网 发布:淘宝情侣装类目 编辑:程序博客网 时间:2024/06/04 15:20
/* *Copyright (c) 2014,烟台大学计算机学院 *All rights reserved. *文件名称: test.cpp *作 者:陈丹 *完成日期:2014年12月15日 *版本号:v1.0 * *问题描述: *输入描述: *程序输出: */#include<iostream> using namespace std; bool existthesame(int *a,int n1,int *b,int n2);int main() { int a[50]; int b[50]; int i, n1, n2; cin>>n1; for(i=0;i<n1;i++) cin>>a[i]; cin>>n2; for(i=0;i<n2;i++) cin>>b[i]; bool flag=existthesame(a,n1,b,n2); if(flag==true) cout<<"YES\n"; else cout<<"NO\n"; return 0; } bool existthesame(int *a,int n1,int *b,int n2) { int i,j; for (i=0;i<n1;i++) for (j=0;j<n2;j++) { if (*(a+i)==*(b+j)) return true; else continue; } }
运行结果:
0 0
- 第十六周项目——oj2
- 第十六周项目1—
- 第十六周项目——第三弹
- 第十六周项目——oj1
- 第十六周项目二—字符串指针
- 第十六周项目6—归并排序
- 第十六周项目7—简单基数排序
- 第十六周项目8—基数排序
- 第十六周项目—复数结构体
- 第十六周项目2—希尔排序
- 第十六周项目3—堆排序
- 第十六周项目4—归并排序
- 第十六周项目5—基数排序
- 第十六周项目6—冒泡排序
- 第十六周项目3—快速排序
- 第十六周项目—计算日期
- 第十六周项目—学生信息排序
- 第十六周项目5—堆排序
- 【C++】【学习笔记】【030-031】错误处理和调试
- NT_iOS笔记—RegexKitLite(stringByReplacingOccurrencesOfRegex:withString:)英文时报错
- 推进 Docker 安全:Docker 1.4.0 和 1.3.3 发布
- Condition大用途
- hdu 2874 Connections between cities hdu 2586 How far away ? LCA
- 第十六周项目——oj2
- Microsoft SQL Server 2008性能分析之执行计划
- money problem
- android 之动画 (二) 插值器
- IOS学习 对于协议的理解
- Object-c @class
- IOS设计模式第十篇之命令行设计模式
- 解决ListView中Item的子控件与Item点击事件冲突
- C# 中的 #region 和 #endregion的作用