
STL
文章平均质量分 87
STILLxjy
不要让任何人打乱你生活的节奏
展开
-
反片语(Ananagrams,Uva 156)
问题描述: 输入一些单词(以“#”为结束标志),找出所有满足如下条件的单词:该单词不能通过字母的重排,得到输入文本中的另一个单词。在判断是否满足条件是不分大小写,但是在输出时应保留输入时的大小写,按字典序进行排列(所有大写字母在所有小写字母前面)。 分析: 利用map#include <iostream>#include <string>#include <cctype>#include原创 2016-04-12 20:36:06 · 720 阅读 · 0 评论 -
C++优先队列priority_queue的详细使用方法
说到队列,我们首先想到就是先进先出,后进后出;那么何为优先队列呢,在优先队列中,元素被赋予优先级,当访问元素时,具有最高级优先级的元素先被访问。即优先队列具有最高级先出的行为特征。优先队列在头文件#include 中;其声明格式为:priority_queue ans;//声明一个名为ans的整形的优先队列基本操作有:empty( ) //判断一个队列是否为空pop( ) //删除...转载 2019-01-13 14:48:42 · 285 阅读 · 0 评论 -
(HDU 5726)GCD <RMQ + map + 二分> 多校训练1
GCD Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3087 Accepted Submission(s): 1116Problem Description Give you a sequence of N(N≤100,0原创 2017-01-07 11:32:20 · 592 阅读 · 0 评论 -
(POJ3087)Shuffle'm Up <模拟,map>
Shuffle’m Up DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, each stac原创 2016-11-21 15:02:00 · 419 阅读 · 0 评论 -
(POJ2503) Babelfish <STL-map/ Trie/ BKDR Hash>
Babelfish DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand转载 2016-11-19 20:55:46 · 663 阅读 · 0 评论 -
(POJ3096)Surprising Strings <STL-map 水题>
Surprising Strings DescriptionThe D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs are different. A strin原创 2016-11-30 16:37:05 · 463 阅读 · 0 评论 -
(POJ 2259) Team Queue 队列的应用 (队列的队列)
Team Queue Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4403 Accepted: 1523 DescriptionQueues and Priority Queues are data structures which are known to most computer scientis原创 2016-10-29 18:30:15 · 617 阅读 · 0 评论 -
Eighty seven (bitset优化) 在n个数中取m个数和为k
Eighty seven Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 802 Accepted Submission(s): 274Problem Description Mr. Fib is a mathematics原创 2016-09-30 12:51:44 · 1458 阅读 · 2 评论 -
Sort 二分 + (队列 + sort 代替优先队列)
Sort Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1695 Accepted Submission(s): 431Problem Description Recently, Bob has just learnt a n转载 2016-09-27 10:16:27 · 800 阅读 · 0 评论 -
G - Grade (sort) 2014 ACM/ICPC Asia Regional Beijing Online
G - Grade Time Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uDescription Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask原创 2016-09-22 22:18:09 · 448 阅读 · 0 评论 -
STL-unique
一.unique函数 类属性算法unique的作用是从输入序列中“删除”所有相邻的重复元素。 该算法删除相邻的重复元素,然后重新排列输入范围内的元素,并且返回一个迭代器(容器的长度没变,只是元素顺序改变了),表示无重复的值范围得结束。// sort words alphabetically so we can find the duplicates sort(words.begin(), wo原创 2016-07-13 16:10:55 · 652 阅读 · 0 评论 -
相同的雪花
相同的雪花 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read in原创 2016-07-07 16:24:49 · 1151 阅读 · 0 评论 -
一道简单题
问题描述: 给出一个包含N个整数的数组,你需要回答若干询问。每次询问两个整数k和v,输出从左到右第k个v的下标(编号从1开始)。 输入包含两组多组数据。每组数据第一行为两个整数n和m,(1<=n,m<=100000),第二行包括n个不超过1000000的整数,即待查询数组。以下m行,每行包括两个整数k,v。 对于每个查询输出查询结果,若果不存在输出0. 分析: 由于每个数需要记录出现时的下原创 2016-05-02 23:39:37 · 1364 阅读 · 0 评论 -
安迪的第一个字典
问题描述: 输入一个文本(以”#”结束),找出所有的不同的单词(连续的字母序列),按字典序输出。单词不区分大小写。 分析: 由于string已经定义了<运算符所以直接用set即可。由于输入时会有非字母字符,所以将所有非字母字符变成空格,然后再用stringstream得到各个单词。 代码:#include <iostream>#include <string>#include <cstr原创 2016-04-12 20:45:04 · 1529 阅读 · 0 评论 -
(LeetCode 502)IPO [优先队列 +仔细读题充分利用题目信息]
502. IPO假设 LeetCode 即将开始其 IPO。为了以更高的价格将股票卖给风险投资公司,LeetCode希望在 IPO 之前开展一些项目以增加其资本。 由于资源有限,它只能在 IPO 之前完成最多 k 个不同的项目。帮助 LeetCode 设计完成最多 k 个不同项目后得到最大总资本的方式。给定若干个项目。对于每个项目 i,它都有一个纯利润 Pi,并且需要最小的资本 Ci 来启动相...原创 2019-01-13 15:08:24 · 222 阅读 · 0 评论