STL
Rocky0429
我愿能朝着太阳生长,做一个温暖的人。
展开
-
完美网络 (优先队列)
完美网络 Time Limit: 1000MS Memory limit: 65536K 题目描述完美网络是连通网络的基础上要求去掉网络上任意一条线路,网络仍然是连通网络。求一个连通网络要至少增加多少条边可以成为完美网络。输入第一行输入一个数T代表测试数据个数(T(0输出对于每个样例输出最少增加多少线路可以成为完美网络。每行输出一个结果。原创 2014-11-26 00:19:23 · 1685 阅读 · 0 评论 -
UVA 340-Master-Mind Hints(STL-map)
Master-Mind HintsTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionMasterMind is a game for two players. One of them, Designer, selects原创 2015-01-03 12:16:30 · 1264 阅读 · 0 评论 -
UVA 10815-Andy's First Dictionary(字符串模拟+排序+重复删除||STL-set)
Andy's First DictionaryTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionProblem B: Andy's First DictionaryTime li原创 2014-12-27 11:47:33 · 1646 阅读 · 0 评论 -
Codeforces Round #296 (Div. 2) C(STL_set)
Glass Carvingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeonid wants to become a glass carver (the pe原创 2015-03-24 19:31:24 · 1212 阅读 · 0 评论 -
Codeforces Round #300-Cutting Banner(substr函数的应用)
Cutting BannerTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionA large banner with word CODEFORCES was ordered for the 1000-th o原创 2015-05-01 16:23:42 · 1889 阅读 · 0 评论 -
HDU 5360(2015多校6)-Hiking(优先队列)
题目地址:HDU 5360 题意:给定n个人,现在要邀请这些人去远足,但每个人同意邀请的条件是当前已经同意去远足的人数c必须满足c>=l[i]&&c<=ri,问你邀请的顺序是什么才能使尽可能多的人去远足,若有多个最优解,输出任意的一个。 思路:先按照L从小到到排序,把当前符合的L放入优先队列中 ,然后对队列中的R从小到大排序,贪心的选择R小的,然后乱搞一番就可以了。#include <stdio原创 2015-08-07 15:08:27 · 1176 阅读 · 0 评论 -
POJ 3253-Fence Repair(优先队列)
题目地址:POJ 3253 题意:有一个农夫要把一个木板钜成n块给定长度的小木板,每次锯都要收取一定费用,这个费用就是当前锯的这个木版的长度,求最小费用。 思路:每次将两个当前的最小值的和放入优先队列中,然后直到剩下一个数为止。#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include原创 2015-08-15 17:08:49 · 1197 阅读 · 0 评论 -
POJ 2503-Babelfish(map)
题目地址:POJ 2503 题意:输入一个字典,字典格式为“英语 外语”的一一映射关系然后输入若干个外语单词,输出他们的 英语翻译单词,如果字典中不存在这个单词,则输出“eh”。 思路:用map存取外语和英语的映射关系,然后找就好了。注意输入格式。#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.原创 2015-08-16 15:20:22 · 1234 阅读 · 0 评论 -
POJ 3087-Shuffle'm Up(map+模拟)
题目地址:POJ 3087 题意:已知两堆牌数均为n的纸牌堆a和b的初始状态, 按给定规则能将他们相互交叉组合成一堆牌str,再将str的最底下的n张牌归为a,最顶的n张牌归为b,依此循环下去。现在输入a和b的初始状态 以及 预想的最终状态c,问a, b经过多少次洗牌之后,最终能达到状态c,若永远不可能相同,则输出”-1”。 思路:用map记录一下当前str出现的状态,如果当前的str在前面出现原创 2015-08-16 16:25:16 · 1509 阅读 · 0 评论 -
HDU 5349(2015多校5)-MZL's simple problem(优先队列)
题目地址:HDU 5349 很水的优先队列就能搞好,只不过注意如果2操作结束后的队列为空,那么Max的值为-inf。#include <stdio.h>#include <math.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <sstream>#include <algorithm>#incl原创 2015-08-05 10:20:26 · 1179 阅读 · 3 评论 -
UVA 10420-List of Conquests(STL-map的应用)
List of ConquestsTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionProblem BList of ConquestsInput: standard inputOutput: standard o原创 2015-01-02 17:32:19 · 1246 阅读 · 0 评论 -
UVA 10132-File Fragmentation(map还原字符串)
File FragmentationThe ProblemYour friend, a biochemistry major, tripped while carrying a tray of computer files through the lab. All of the files fell to the ground and broke. Your friend pick原创 2015-02-06 10:25:23 · 1249 阅读 · 0 评论 -
Message Flood(STL)
Message FloodCrawling in process...Crawling failedTime Limit:1500MS Memory Limit:65536KB 64bit IO Format:%lld & %lluSubmitStatus DescriptionWell, how do you feel about mob原创 2014-08-04 18:18:43 · 1081 阅读 · 0 评论 -
Hardwood Species(STL)
Hardwood SpeciesCrawling in process...Crawling failedTime Limit:10000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionHardwoods are the botan原创 2014-08-04 15:34:41 · 1268 阅读 · 0 评论 -
Orders(STL)
OrdersCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionThe stores manager has sorted all原创 2014-07-30 20:44:46 · 1250 阅读 · 0 评论 -
看病要排队(优先队列)
看病要排队Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatus Description看病要排队这个是地球人都知道的常识。不过经过细心的0068原创 2014-11-15 16:35:12 · 1694 阅读 · 0 评论 -
For Fans of Statistics(STL)
- For Fans of StatisticsCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionHa原创 2014-08-06 00:15:56 · 1208 阅读 · 0 评论 -
Surprising Strings(STL)
Surprising StringsCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionThe D-pairs of a str原创 2014-08-04 23:48:42 · 1211 阅读 · 0 评论 -
Black Box(STL)
Black BoxCrawling in process...Crawling failedTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmitStatus DescriptionOur Black Box represents a prim原创 2014-08-05 20:10:57 · 1373 阅读 · 0 评论 -
树-堆结构练习——合并果子之哈夫曼树(STL)
Description 在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所消耗体力之和。Input 第一行是一个整数n(1<=原创 2014-08-04 09:59:46 · 1723 阅读 · 0 评论 -
UVA 10954- Add All(优先队列)
Add AllTime Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionProblem FAdd AllInput: standard inputOutput: standard outputYup!! The原创 2015-02-05 08:28:32 · 1239 阅读 · 0 评论 -
STL常用操作
原文请见:点我啊点我啊代码純手打印证/*迭代器(iterator)#include <iostream>#include <vector>using namespace std;int main(){ vector<int >vec; for(int i=0;i<10;i++){ vec.push_back(i); } vector<int >转载 2017-03-25 14:30:55 · 1207 阅读 · 0 评论