
STL
STL
Guuuuuu老师儿
当初的算法竞赛题目博客的留言评论就不回复了,时间太久已经忘干净了,抱歉~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[STL]next_permutation
文章转载至 http://leonard1853.iteye.com/blog/14500851、碰到next_permutation(permutation:序列的意思)今天在TC上碰到一道简单题(SRM531 - Division Two - Level One),是求给定数组不按升序排列的最小字典序列(Sequence of numbers A is lexicographi转载 2017-09-08 10:47:14 · 241 阅读 · 0 评论 -
L2-021. 点赞狂魔
L2-021. 点赞狂魔 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支...原创 2018-03-12 12:12:18 · 404 阅读 · 0 评论 -
L2-014. 列车调度
L2-014. 列车调度 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 火车站的列车调度铁轨的结构如下图所示。Figure两端分...原创 2018-03-16 20:23:27 · 253 阅读 · 0 评论 -
词频统计(30 point(s))
词频统计(30 point(s))请编写程序,对一段英文文本,统计其中所有不同单词的个数,以及词频最大的前10%的单词。所谓“单词”,是指由不超过80个单词字符组成的连续字符串,但长度超过15的单词将只截取保留前15个单词字符。而合法的“单词字符”为大小写字母、数字和下划线,其它字符均认为是单词分隔符。输入格式:输入给出一段非空文本,最后以符号#结尾。输入保证存在至少10个不同的单词。输出格式:在...原创 2018-02-14 20:26:24 · 1486 阅读 · 0 评论 -
Sonya and Queries CodeForces - 714C (map映射)
Sonya and QueriesCodeForces - 714CToday Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give原创 2018-02-05 08:54:57 · 282 阅读 · 0 评论 -
Calculator Conundrum UVA - 11549(set或Floyd判圈法)
Calculator ConundrumUVA - 11549题意:有个老式计算器,每次只能记住一个数字的前n位。现在输入一个整数k,然后反复平方,一直做下去,能得到的最大数是多少。例如,n=1,k=6,那么一次显示:6,3,9,1...思路:这个题一定会出现循环,所以一个个模拟,遇到相同的就再之前所有数中找最大的输出即可。怎么判断遇到相同的呢?如果装在数组里一一比原创 2017-11-23 13:41:54 · 262 阅读 · 0 评论 -
Magic Powder - 1 CodeForces - 670D1 (优先队列)
Magic Powder - 1 CodeForces - 670D1 This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single原创 2017-11-15 21:28:20 · 402 阅读 · 0 评论 -
Cinema CodeForces - 670C (map,一维坐标离散化,排序)
Cinema CodeForces - 670C Moscow is hosting a major international conference, which is attended by nscientists from different countries. Each of the scientists knows exactly one language.原创 2017-11-15 21:02:18 · 552 阅读 · 0 评论 -
Misha and Changing Handles CodeForces - 501B(map映射)
Misha and Changing HandlesCodeForces - 501BMisha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times.原创 2017-11-15 20:09:00 · 325 阅读 · 0 评论 -
Backward Digit Sums POJ - 3187(next_permutation全排列)
Backward Digit SumsPOJ - 3187FJ and his cows enjoy playing a mental game. They write down the numbers from 1 to N (1 <= N <= 10) in a certain order and then sum adjacent numbers to produ原创 2017-11-06 18:49:50 · 296 阅读 · 0 评论 -
Orders POJ - 1731(next_permutation函数)
Orders POJ - 1731The stores manager has sorted all kinds of goods in an alphabetical order of their labels. All the kinds having labels starting with the same letter are stored in the same war原创 2017-11-05 10:26:51 · 390 阅读 · 0 评论 -
map结构体作为key值的使用
最近在使用stl中的map容器时,碰到key为结构体的情况,总结如下,以便提醒自己。因为之前从没用结构体作为key值,也就没出现这种情况,结果报错后很崩溃看不懂后来才知道map中的key默认是以less所以要对结构体中然后就可以使用了原创 2017-11-04 11:12:20 · 5197 阅读 · 0 评论 -
lower_bound和upper_bound算法
因为这几天做到一些,用lower_bound和upper_bound的题,在网上看到一篇很好的博客,索性就直接转过来了原文地址 :http://www.cnblogs.com/cobbliu/archive/2012/05/21/2512249.htmlSTL中的每个算法都非常精妙,接下来的几天我想集中学习一下STL中的算法。 ForwardIter lower_bound(转载 2017-10-29 16:03:24 · 692 阅读 · 0 评论 -
Distances to Zero(lower_bound和upper_bound应用)
B. Distances to Zerotime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the array of integer numbers a0,原创 2017-10-29 15:53:15 · 491 阅读 · 0 评论 -
c++四舍五入函数,向上取整,向下取整函数
对含有小数点的数进行四舍五入是比较普遍的一种需求。在C++中也有类似的取整函数。在C++的头文件中有floor()和ceil()函数。在STL中还有round()函数。这三个函数的作用如下: 函数名称函数说明2.12.9-2.1-2.9Floor()不大于自变量的最大整数22-3-原创 2017-10-18 20:40:53 · 28274 阅读 · 0 评论 -
L2-005. 集合相似度
L2-005. 集合相似度 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 给定两个整数集合,它们的相似度定义为:Nc/Nt*10...原创 2018-03-30 18:26:09 · 175 阅读 · 0 评论