博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ZOJ 3185 List Operations
阅读量:4347 次
发布时间:2019-06-07

本文共 982 字,大约阅读时间需要 3 分钟。

题意:字符串a+b or a-b 例:

Sample Input

[1,2,3] ++ [1,2,3]
[a,b,c,t,d,e,t,x,y,t] -- [t]
[a,b,c,t,d,e,t,x,y,t] -- [t,t,t,t]
[123] ++ [456]
.
Sample Output
[1,2,3,1,2,3]
[a,b,c,d,e,t,x,y,t]
[a,b,c,d,e,x,y]
[123,456]

思路:vector。。。。。。。。

题目链接:

 

View Code
1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 using namespace std; 9 10 vector
vec;11 vector
::iterator it;12 string str1,str2,op;13 14 void Push(string str1){15 vec.clear();16 string str;17 int len=str1.size();18 for(int i=1;i
>str1){62 if(str1==".") break;63 vec.clear();64 cin>>op>>str2;65 Push(str1);66 if(op=="++") Add(str2);67 else Sub(str2);68 it=vec.begin();69 cout<<"[";70 if(it!=vec.end()){71 for(it=vec.begin();it!=vec.end();it++){72 cout<<*it;73 if(it+1!=vec.end()) cout<<",";74 }75 }76 cout<<"]"<

转载于:https://www.cnblogs.com/Hug-Sea/articles/2485402.html

你可能感兴趣的文章
python基础
查看>>
python:列表和元组
查看>>
python:字符串
查看>>
python:集合
查看>>
python字符编码与转码
查看>>
python:文件操作
查看>>
python:字典
查看>>
python:函数
查看>>
python:模块
查看>>
python:常用模块
查看>>
python:面向对象
查看>>
python3.5+Django2.2+pymysql+mysql
查看>>
node层设置proxy不生效的原因
查看>>
react 16.3+ 新生命周期 作业
查看>>
KMP整理
查看>>
字典树
查看>>
AC自动机
查看>>
网络赛补题
查看>>
Manacher-马拉车算法
查看>>
字符串哈希+kmp题
查看>>