hdu3527(STL)
来源:互联网 发布:grub命令行引导ubuntu 编辑:程序博客网 时间:2024/06/07 05:57
链接:点击打开链接
题意:给出三行字符串,输出第二行中在第一行出现并且不在第三行出现的字符串
代码:
#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"; //注意输出,会pe else cout<<ans[i]<<" "; } } } return 0;}
0 0
- hdu3527(STL)
- HDU3527 SPY 【集合】
- hdu3527 SPY 水题
- stl
- stl
- STL
- STL
- STL
- STL
- STL
- STL
- STL
- stl
- STL
- STL
- STL
- STL
- STL
- 高性能网站开发
- Java序列化的作用和反序列化
- 《leetCode》:Binary Search Tree Iterator
- ReactJS学习系列课程(JSX语法)
- android:screenOrientation属性
- hdu3527(STL)
- Linux与Windows 在软件开发能力上的较量
- C++ 实验五
- 前端常见图片格式整理
- C++拷贝构造函数(深拷贝,浅拷贝)
- 仿UC的菜单弹出,布局半透明,控件不受影响。
- C++类构造函数初始化列表
- iOS自定义组件-扇形进度视图
- 浅谈StringBuffer类初始容量及扩容