
C++ STL
eeetttzhangji
这个作者很懒,什么都没留下…
展开
-
#include<stack> 南阳oj括号匹配
描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0输出每组输入数据的输出占一行,如果该字符串中所含的括号是配对的,则输出Yes,如果不配对则输出No样例输入3[(])(])([[]()])样例输出NoNoYesc++ stl栈stack介绍C++ Stack(堆栈) 是一个原创 2017-03-18 21:34:17 · 1510 阅读 · 0 评论 -
c++ string的运用
You are given a string s and should process m queries. Each query is described by two 1-based indices li, ri and integer ki. It means that you should cyclically shift the substring s[li... ri] ki ti原创 2017-04-03 20:31:56 · 336 阅读 · 0 评论 -
set的简单应用
MG loves goldTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 144 Accepted Submission(s): 85Problem DescriptionMG is a lucky boy原创 2017-04-02 20:19:30 · 475 阅读 · 0 评论 -
C++中lower_bound函数和upper_bound函数
STL中关于二分查找的函数有三个lower_bound 、upper_bound 、binary_search 。这三个函数都运用于有序区间(当然这也是运用二分查找的前提),下面记录一下这两个函数。ForwardIter lower_bound(ForwardIter first, ForwardIter last,const _Tp& val)算法返回一个非递减序列[first,转载 2017-03-25 21:20:06 · 607 阅读 · 0 评论 -
C. Andryusha and Colored Balloons
C. Andryusha and Colored Balloonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndryusha goes through a转载 2017-03-16 12:41:03 · 401 阅读 · 0 评论 -
STL 双向队列
deque双端队列容器与vector很类似,采用线性表顺序存储结构。但与vector区别,deque采用分块的线性存储结构来存储数据,每块的大小一般为512B,将之称为deque块,所有的deque块使用一个map块进行管理,每个map数据项记录各个deque块的首地址,这样的话,deque块在头部和尾部都可以插入和删除。而不需要移动任何元素,而不需要移动其他元素(使用push_back()方法在转载 2017-04-01 11:37:49 · 388 阅读 · 1 评论 -
B. Not Afraid STL set
B. Not Afraidtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSince the giant heads have appeared in the sk原创 2017-03-24 11:51:09 · 976 阅读 · 0 评论 -
c++ set
#include#include#includeusing namespace std;set S;int main(){ int temp; int i; for(i=1;i<7;i++) { cin>>temp; S.insert(temp); } cout<<S.size()<<endl; set::iterator r; set::reverse_ite原创 2017-03-14 17:24:00 · 352 阅读 · 0 评论 -
c++ string
#include #include using namespace std;int main(){ string strinfo="Please input your name:"; cout << strinfo ; cin >> strinfo; if( strinfo == "winter" ) cout << "you are winter!"<<endl; else转载 2017-03-14 16:51:08 · 174 阅读 · 0 评论 -
map 的使用例子
Skip the ClassTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 374 Accepted Submission(s): 222Problem DescriptionFinally term原创 2017-03-14 16:11:52 · 382 阅读 · 0 评论 -
long double atan2函数 Pi=acos(-1)
You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the minimal non-oriented angle between them.Non-oriented angle is non-原创 2017-04-03 21:20:56 · 916 阅读 · 0 评论