2034-人见人爱A-B(c++实现)
呵呵,很简单吧?
如果n=0并且m=0表示输入的结束,不做处理。
0 0
#include<iostream>
using namespace std; static int A[],B[];
void input(int a[],int n){
for(int i=;i<n;i++)
cin>>a[i];
}
void sort(int a[],int n){
for(int i=;i<n-;i++){
int max=;
for(int j=;j<n-i;j++)
if(a[j]>a[max])
max=j;
int temp=a[max];a[max]=a[n--i];a[n--i]=temp;
}
}
void compare(int n,int m){
int i=,j=,temp=; //temp标记是否输出NULL
while(i<n){
if(A[i]<B[j]||A[i]>B[m-]){
cout<<A[i]<<" ";
temp=;
i++;continue;
}
if(A[i]==B[j]){
i++,j++;
continue;
}
if(A[i]>B[j]){
j++;continue;
}
}
if(!temp)
cout<<"NULL";
}
int main(){
int n,m;
while((cin>>n>>m)&&(n||m)){
input(A,n);sort(A,n);
input(B,m);sort(B,m);
compare(n,m);
cout<<endl;
}
return ;
}
2034-人见人爱A-B(c++实现)的更多相关文章
- hdu 2034 人见人爱A-B
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Description 参加过上个月月赛的同学一定还记得其中的一个最简单的题目, ...
- 杭电 2034 人见人爱A-B
http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Mem ...
- hdu 2034人见人爱A-B
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2034 解题思路:set的基本用法 #include<iostream> #include& ...
- HDU 2034 人见人爱A-B 分类: ACM 2015-06-23 23:42 9人阅读 评论(0) 收藏
人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- 杭电2034——人见人爱A-B
#include <stdio.h> #include <algorithm> using namespace std; int main () { int a[110],b[ ...
- HDU 2034 人见人爱A-B【STL/set】
人见人爱A-B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...
- hdoj 2034 人见人爱A-B
Problem Description 参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法 ...
- 杭电oj2028、2034、2035、2041、2043-2046
2028 Lowest Common Multiple Plus #include<stdio.h> int gcd(int a,int b){ int temp,temp1; if(a ...
- HDU 2035 人见人爱A^B 分类: ACM 2015-06-22 23:54 9人阅读 评论(0) 收藏
人见人爱A^B Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Su ...
- (Set) 人见人爱A-B HDU2034
人见人爱A-B 链接:http://acm.hdu.edu.cn/showproblem.php?pid=2034 JAVA代码借鉴链接:https://blog.csdn.net/superbeau ...
随机推荐
- sqlserver -- 学习笔记(八)体验charindex、stuff 和 for xml path在实际问题中的应用及几个问题的探讨
写在前面 之前做了个微信端顾客扫码评价员工的功能,除了打分数,还可以打标签. 需要统计分数和统计各个员工每种标签被点击的次数. 后来加了个要求,需要查看客户对某个员工一次服务所打出的标签组合. 在不 ...
- Docker之Linux Namespace
Linux Namespace 介绍 我们经常听到说Docker 是一个使用了Linux Namespace 和 Cgroups 的虚拟化工具,但是什么是Linux Namespace 它在Docke ...
- NodeJs连接Oracle数据库
nodejs连接oracle数据库,各个平台的官方详情文档:https://github.com/oracle/node-oracledb/blob/master/INSTALL.md 我的nodej ...
- 可视化(番外篇)——在Eclipse RCP中玩转OpenGL
最近在看有关Eclipse RCP方面的东西,鉴于Gephi是使用opengl作为绘图引擎,所以,萌生了在Eclipse RCP下添加画布,使用opengl绘图的想法,网上有博文详细介绍这方面的内容, ...
- 把图片加载到BufferedImage中
把图片加载到BufferedImage 中有什么作用呢?它就可以利用 ImageIO.write(image, "JPEG", response.getOutputStream() ...
- java线程(1)--概念基础
参考:http://lavasoft.blog.51cto.com/62575/99150 http://blog.csdn.net/baby_newstar/article/details/6783 ...
- Python访问剪切板
剪切板访问工具 ----pyperclip he purpose of Pyperclip is to provide a cross-platform Python module for copyi ...
- 使用Python将HTML转成PDF
主要使用的是wkhtmltopdf的Python封装--pdfkit 安装 1. Install python-pdfkit: $ pip install pdfkit 2. Install wkht ...
- github.com/dotnet/orleans
Orleans is a framework that provides a straight-forward approach to building distributed high-scale ...
- 图片和Base64之间的转换
public static Bitmap GetImageFromBase64String(string strBase) { try { MemoryStream stream = new Memo ...