
STL基础
Floraqiu
有志者事竟成,破釜沉舟,百二秦关终属楚。
苦心人天不负,卧薪尝胆,三千越甲可吞吴。
展开
-
queue 和 priority queue容器介绍
一.queue 1、queue模版类的定义在 queue 头文件中。 queue与stack模版非常类似,queue模版也需要定义两个模版参数,一个是元素类型,一个是容器类型,元素类型是必要的,容器类型是可选的,默认为deque类型。定义queue对象的示例代码如下:queueint>q1;queuedouble>q2;2、queue的基本操作有: 1.转载 2018-01-22 15:18:07 · 391 阅读 · 0 评论 -
最大公约数,最小公倍数
最大公约数,最小公倍数#库函数#include<algorithm>Lowest Common Multiple直接求最小公倍数Greatest Common Divisor直接求最大公约数x=__lcm(a,b,c,…….)x=__gcd(a,b,c,…….)有两个下划线!而且它们不是标准库文件中的函数,在竞赛中禁止使用#代码实现最大公约数:...原创 2017-09-05 00:04:11 · 539 阅读 · 0 评论 -
【STL + 模拟】The Blocks Problem UVA - 101 【紫书例题】
【STL】The Blocks Problem UVA - 101 【紫书例题】Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AI study of planning and robotic...原创 2018-07-25 19:58:38 · 527 阅读 · 0 评论 -
【STL + 模拟】Ugly Numbers UVA - 136
【STL + 模拟】Ugly Numbers UVA - 136Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, … shows the first 11 ugly numbers. By convention, ...原创 2018-07-25 20:06:42 · 471 阅读 · 0 评论 -
【STL+暴力枚举】Compound Words UVA - 10391
【STL+暴力枚举】Compound Words UVA - 10391You are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is the concatenation of exactly two ot...原创 2018-07-26 09:01:21 · 334 阅读 · 0 评论 -
【STL + 几何】Nearest vectors CodeForces - 598C 【求两点间极角差】long double atan2(long double y,long double x)
求原点至点(x,y)的方位角,即与 x 轴的夹角的函数 long double atan2(long double y,long double x)【STL + 几何】Nearest vectors CodeForces - 598C 【求两点间极角差】You are given the set of vectors on the plane, each of them startin...原创 2018-07-26 08:59:56 · 326 阅读 · 0 评论 -
【STL】Numbers HDU - 6168 【混合原数列和导出数列,找出原数列】
【STL】Numbers HDU - 6168 【混合原数列和导出数列,找出原数列】zk has n numbers a1,a2,…,an. For each (i,j) satisfying 1≤ i &lt; j≤ n, zk generates a new number (ai+aj). These new numbers could make up a new sequence b1,...原创 2018-07-28 13:20:31 · 268 阅读 · 0 评论 -
【dp】或者玄学【库函数】?Two strings HDU - 6170 【正则匹配字符串】
【dp】或者玄学【库函数】?Two strings HDU - 6170 【正则匹配字符串】Giving two strings and you should judge if they are matched. The first string contains lowercase letters and uppercase letters. The second string co...原创 2018-07-28 13:19:34 · 226 阅读 · 0 评论 -
【STL】【bitset 二进制】【总结】使用biset进行二进制操作
【STL】【bitset 二进制】【总结】使用biset进行二进制操作 1、简介bitset是用来进行一些状态储存的操作。类似于一个标记数组,又类似于状压里面的二进制。它与状压的共同点是都可以直接进行一些二进制操作。而且好用的是它类似于动态数组,可以开很多位,方便对每一位进行操作。需要调用bitset库。位数左边是高位,右边是低位。从0开始。可以直接访问为b[0]2、初始...原创 2018-08-09 18:02:58 · 1324 阅读 · 0 评论 -
sort函数 南华新生训练2017-字符串排序
描述 给出n(n<300)个字符串:S1,S2……Sn;每个字符串的长度不超过100,将这n个字符串按字典序升序输出; 输入 单组输入; 第一行输入一个整数n(n<300); 2到n+1行输入n个字符串Si;|Si|<100; 输出 按字典序升序输出n行。 样例输入1 复制 4 a c d b 样例输出1原创 2017-11-12 22:18:27 · 345 阅读 · 0 评论 -
1/20集训一 STL A.(括号配对,栈)Replace To Make Regular Bracket Sequence
1/20 集训一 STLA.(括号配对,栈)Replace To Make Regular Bracket Sequence You are given string s consists of opening and closing brackets of four kinds . The following definition of a regular bra原创 2018-01-20 23:55:59 · 308 阅读 · 0 评论 -
1/20集训一 STL B.(用set/map记录元素是否重复出现)Pearls in a Row
1/20集训一 STLB.(用set/map记录元素是否重复出现)Pearls in a Row There are n pearls in a row. Let’s enumerate them with integers from 1 to n from the left to the right. The pearl number i has the type ai.原创 2018-01-21 00:29:53 · 313 阅读 · 0 评论 -
STL整理
STL的代码从广义上讲分为三类:algorithm(算法)、container(容器)和iterator(迭代器),几乎所有的代码都采用了模板类和模版函数的方式,这相比于传统的由函数和类组成的库来说提供了更好的代码重用机会。 在C++标准中,STL被组织为下面的13个头文件:algorithm>、deque>、functional>、iterator>、vector>、list>、map原创 2018-01-22 15:18:18 · 235 阅读 · 0 评论 -
1/22 测试一(STL 模拟 贪心)A.(next_permutation() 求四个数字组成的所有四位数) 排列2
1/22 测试一(STL 模拟 贪心)A.(next_permutation() 求四个数字组成的所有四位数) 排列2 Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。 Input 每组数据占一行,代表四张卡片上的数字(0 Output 对每组卡片按从小到大的顺序输出所有能原创 2018-01-22 23:13:58 · 466 阅读 · 0 评论 -
1/20集训一 STL F.(multiset 分割玻璃 ,求最大面积) Glass Carving
1/20集训一 STLF.(multiset 分割玻璃 ,求最大面积) Glass Carving Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm ×原创 2018-01-22 22:50:39 · 720 阅读 · 1 评论 -
1/20集训一 STL H.(map A=B,B=C,求A=C)Misha and Changing Handles
1/20集训一 STLH.(map A=B,B=C,求A=C)Misha and Changing Handles Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any num原创 2018-01-22 15:18:41 · 299 阅读 · 0 评论 -
1/20集训一 STL I.(next_permutation 寻找第N小序列子串) Ignatius and the Princess II
1/20集训一 STLI.(next_permutation (algorithm) 寻找第N小序列子串) Ignatius and the Princess II Now our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill原创 2018-01-22 15:18:29 · 345 阅读 · 0 评论 -
1/20集训一 STL G.(multimap 找出标准形式只出现一次的单词,并按字典序输出原单词)Ananagrams
1/20集训一 STLG.(multimap 找出标准形式只出现一次的单词,并按字典序输出原单词)Ananagrams Most crossword puzzle fans are used to anagrams— groups of words with the same letters in different orders — for example OPTS, SP原创 2018-01-21 19:09:00 · 480 阅读 · 0 评论 -
1/20集训一 STL D. (stack 火车进站问题) Train Problem I
1/20集训一 STLD. (stack 火车进站问题) Train Problem IAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in原创 2018-01-21 08:39:02 · 496 阅读 · 0 评论 -
1/20集训一 STL C. (set/map +string 找单词按字典序排列) Andy's First Dictionary
1/20集训一 STLC. (set/map +string 找单词按字典序排列) Andy’s First Dictionary Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of wor原创 2018-01-21 08:27:50 · 426 阅读 · 0 评论 -
【贪心】【set】 CodeForces - 999D Equalize the Remainders 【n个数对m取余,使0 - m-1每种情况的个数都为n/m个,求最少需操作次数】
【贪心】【set】 CodeForces - 999D Equalize the Remainders 【n个数对m取余,使0 - m-1每种情况的个数都为n/m个,求最少需操作次数】You are given an array consisting of n integers a1,a2,…,an, and a positive integer m. It is guaranteed ...原创 2018-08-08 20:59:14 · 469 阅读 · 0 评论