hdu3527spy(STL,map)

Description

The NationalIntelligence(情报工作) Council(委员会) of X Nation receives a piece ofcredible(可靠的) informationthat Nation Y will send spies(间谍) to stealNation X’s confidential(机密的) paper. So thecommander(指挥官) of TheNational Intelligence Council take measures immediately, he will investigate(调查) people who will come into Nation X. Atthe same time, there are two List in the Commander’s hand, one is full of spiesthat Nation Y will send to Nation X, and the other one is full of spies thatNation X has sent to Nation Y before. There may be some overlaps(重复) of the two list. Because the spy(间谍) may act two roles at the same time, whichmeans that he may be the one that is sent from Nation X to Nation Y, we justcall this type a “dual-spy”. So Nation Y may send “dual_spy” back to Nation X,and it is obvious now that it is good for Nation X, because “dual_spy” maybring back NationY’s confidential paper without worrying to be detention(挽留) by NationY’s frontier(边界) So the commander decides to seize thosethat are sent by NationY, and let the ordinary people and the “dual_spy” in atthe same time .So can you decide a list that should be caught by the Commander? 
A:the list contains that will come to the NationX’s frontier. 
B:the list contains spies that will be sent by Nation Y. 
C:the list contains spies that were sent to NationY before. 

Input

There areseveral test cases. 
Each test case contains four parts, the first part contains 3 positive integersA, B, C, and A is the number which will come into the frontier. B is the numberthat will be sent by Nation Y, and C is the number that NationX has sent toNationY before. 
The second part contains A strings, the name list of that will come into thefrontier. 
The second part contains B strings, the name list of that are sent by NationY. 
The second part contains C strings, the name list of the “dual_spy”. 
There will be a blank line after each test case. 
There won’t be any repetitive(
重复的) names in asingle list, if repetitive names appear in two lists, they mean the samepeople. 

Output

Output the listthat the commander should caught (in the appearance order of the lists B).if noone should be caught, then , you should output “No enemy spy”

Sample Input

8 4 3

Zhao Qian Sun LiZhou Wu Zheng Wang

Zhao Qian Sun Li

Zhao Zhou Zheng

2 2 2

Zhao Qian

Zhao Qian

Zhao Qian

Sample Output

Qian Sun Li

No enemy spy

题意:X国收到一个机密消息,Y国将要送特工来头X国家的机密,因此国家委员会的指挥官立即采取措施,他将派遣人送往X国,与此同时,这儿是两列(2种不同职务的)人为指挥官管辖,一列充满了Y国送往X国家的特工,另一列是在Y国送往X国之前已经被X国送来的特工。。。

         给出三行字符串,输出第二行中在第一行出现并且不在第三行出现的字符串。

代码:

#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
map<string,int>Map;
int main()
{int a,b,c;while(scanf("%d%d%d",&a,&b,&c)!=EOF){string str[10000];Map.clear();for(int i=0;i<a;i++){string s;cin>>s;Map[s]=1;}for(int i=0;i<b;i++){cin>>str[i];Map[str[i]]++;}for(int i=0;i<c;i++){string s;		cin>>s;Map[s]--;}int flag=0;for(int i=0;i<b;i++){if(Map[str[i]]==2){if(flag)printf(" ");cout<<str[i];flag=1;}}if(flag==0){cout<<"No enemy spy"<<endl;}elseputs("");}return 0;
}

#include <vector>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int a,b,c;
vector<string> x,y,z,ans;
int main(){int i,j,k;string s;while(scanf("%d%d%d",&a,&b,&c)!=EOF){x.clear(),y.clear(),z.clear(),ans.clear();for(i=0;i<a;i++){cin>>s;x.push_back(s);}for(i=0;i<b;i++){cin>>s;y.push_back(s);}for(i=0;i<c;i++){cin>>s;z.push_back(s);}for(i=0;i<b;i++){                       //判断在第一个中出现,没在第三个中出现的if(find(x.begin(),x.end(),y[i])!=x.end())if(find(z.begin(),z.end(),y[i])==z.end())ans.push_back(y[i]);}if(!ans.size())puts("No enemy spy");else{for(i=0;i<ans.size();i++){if(i==ans.size()-1)cout<<ans[i]<<"\n";             //注意输出,会peelsecout<<ans[i]<<" ";}}}return 0;
}


本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/510431.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

万节点规模云服务的 SRE 能力建设

背景及现状 系统架构简介 上图为阿里云内部实际使用的系统架构&#xff0c;系统主要用途为实时数据流的计算和存储。使用阿里云的容器服务 ACK 作为系统底座&#xff0c;容器化的部署、发布、管控等全部基于 K8s 标准。使用自己开发的 Gateway service 作为系统流量入口&#…

HDU 3532 Max Angle(计算几何——极角排序)

Description Given manypoints in a plane, two players are playing an interesting game. Player1 selects one point A as the vertex(顶点) of an angle. Then player2 selects other two points Band C. A, B and C are different with each other. Now they get an an…

阿里云 ACK 容器服务生产级可观测体系建设实践

ACK 可观测体系介绍 全景概要介绍 上图为 ACK 可观测体系全景图金字塔&#xff0c;从上至下可分为四层&#xff1a; 最上层是最接近用户业务的 Business Monitoring&#xff0c;包括用户业务的前端的流量、PV、前端性能、JS 响应速度等监控。通过容器服务的 IngressDashboard…

中仑网络全站 Dubbo 2 迁移 Dubbo 3 总结

中仑网络在 2022 年完成了服务框架从 Dubbo 2 到 Dubbo 3 的全站升级&#xff0c;深度使用了应用级服务发现、Kubernetes 原生服务部署、服务治理等核心能力。来自中仑网络的技术负责人来彬彬对整个 Dubbo 3 的选型、升级过程及收益等做了深入总结。 来彬彬&#xff0c;2020 年…

hdu3526(最小费用流)

Description Xiao A isbecoming more and more unsatisfied with his computer since he is learninghacker(黑客技术) technologiesthese days but his computer always fails whenever he changes the configurationsof the NIC. He buys a new NIC but the motherboard doe…

hdu3530Subsequence【单调队列优化dp】2010多校联合

Description There is asequence(顺序&#xff0c;序列) of integers.Your task is to find the longest subsequence(子序列) that satisfies the following condition: the differencebetween the maximum element and the minimum element of the subsequence is nosmaller…

基于 OpenYurt 和 EdgeX 的云边端协同新可能

2022 EdgeX 中国挑战赛暨中关村国际前沿科技创新大赛 EdgeX 专题赛正式拉开帷幕。本次大赛分设两大赛道&#xff1a;医疗、教育、消费行业赛道和能源、工业、供应链赛道。大赛致力于构建一个物联网及边缘计算的学习和分享平台&#xff0c;基于 EdgeX Foundry、OpenYurt 等开源技…

OSCAR 2022 开源产业大会PolarDB-X、 PolarDB-PG获奖揭晓

9月16日&#xff0c;OSCAR 2022 开源产业大会在京召开&#xff0c;会议由中国信息通信研究院、中国通信标准化协会主办&#xff0c;中国通信标准化协会云计算标准和开源推进委员会承办。此次会议以“千行百业 可信开源”为主题&#xff0c;邀请上百位专家大咖和国内主流的开源社…

C链表(顺序表、静态链表区别)

#include <stdio.h> #include <stdlib.h> #define LIST_INIT_SIZE 1000 //线性表存储空间的初始分配量 #define LISTINCRESEMENT 100 //线性表存储空间的分配增量 #define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef int elemType;//元素类型…

HDU3534 给你一个树让你找出其中最长路径以及个数数

Description In the Datastructure class of HEU, the teacher asks one problem: How to find the longestpath(路径) of one treeand the number of such longest path? Input There are several test cases. The firstline of each case contains only one integer N, m…

国庆训练赛

Description Consider the following programming language. This language contains only two types of statements: simple statements and compound statements. The simple statement is in the form “write (literal)”, where “write” is a key word indicating that …

App 隐私合规“免费”自动化检测

一、为什么要进行App隐私合规检测 2021年11月1日《个人信息保护法》正式生效&#xff1b;今年6月14日&#xff0c;国家互联网信息办公室公布《移动互联网应用程序信息服务管理规定》&#xff0c;这是针对App的最强监管新规&#xff0c;于8月1日起正式实施。新规要求应用程序提…

POJ3420 Quad Tiling(模板+矩阵快速幂)

Quad Tiling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4107 Accepted: 1878 Description Tired of(厌烦) the Tri Tiling gamefinally, Michael turns to(转向) a morechallengeable game, Quad Tiling: In how many ways can you tile(铺瓷砖) a 4 …

跨模态学习能力再升级,EasyNLP 电商文图检索效果刷新 SOTA

导读 多模态内容&#xff08;例如图像、文本、语音、视频等&#xff09;在互联网上的爆炸性增长推动了各种跨模态模型的研究与发展&#xff0c;支持了多种跨模态内容理解任务。在这些跨模态模型中&#xff0c;CLIP&#xff08;Contrastive Language-Image Pre-training&#x…

EasyNLP 带你实现中英文机器阅读理解

导读 机器阅读理解是自然语言处理&#xff08;NLP&#xff09;&#xff0c;特别是自然语言理解&#xff08;NLU&#xff09;领域最重要的研究方向之一。自1977年首次被提出以来&#xff0c;机器阅读理解已有近50年的发展史&#xff0c;历经“人工规则”、“传统机器学习”、“…

开关问题(模板+高斯消元)

开关问题Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 7771 Accepted: 3058 Description 有N个相同的开关&#xff0c;每个开关都与某些开关有着联系&#xff0c;每当你打开或者关闭某个开关的时候&#xff0c;其他的与此开关相关联的开关也会相应地发生变化&am…

一文剖析 PolarDB HTAP 的列存数据压缩

前言 数据库迁移上云是大数据时代的一大趋势&#xff0c;PolarDB MySQL是阿里云自研的云原生数据库&#xff0c;主要处理在线事务负载(OLTP, OnLine Transactional Processing)&#xff0c;深受企业用户的青睐。当下&#xff0c;数据分析对于企业的重要性越发显著&#xff1a;…

技术解读:现代化工具链在大规模 C++ 项目中的运用

编者按&#xff1a;C 语言与编译器一直都在持续演进&#xff0c;出现了许多令人振奋的新特性&#xff0c;同时还有许多新特性在孵化阶。除此之外&#xff0c;还有许多小更改以提高运行效率与编程效率。本文整理自全球 C 及系统软件技术大会上的精彩分享&#xff0c;接下来由作者…

扩展的欧几里得算法

任务&#xff1a; 求出A,B的最大公约数&#xff0c;且求出X&#xff0c;Y满足AXBYGCD(A,B). 模板代码&#xff1a; int extendGcd(int a,int b,int &x,int &y) {if(!b){x1;y0;return a;}else{int rextendGcd(b,a%b,y,x);y-x*(a/b);return r;} }

Stein算法(求两个数最大公约数)

欧几里德算法是计算两个数最大公约数的传统算法&#xff0c;他无论从理论还是从效率上都是很好的。但是他有一个致命的缺陷&#xff0c;这个缺陷只有在大素数时才会显现出来。 考虑现在的硬件平台&#xff0c;一般整数最多也就是64位&#xff0c;对于这样的整数&#xff0c;计…