摘要: C. Journey time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n cities and n - 1 阅读全文
posted @ 2017-10-07 10:45 楼主好菜啊 阅读(286) 评论(0) 推荐(0) 编辑
摘要: vector 是一个容器, 它能存放各种类型的对象,简单的说, vector 是一个可以存放任意类型的动态数组,可以动态改变大小。 vector 的功能 vector<int>c; c.clear() // 清空数组中的全部元素 c.empty() // 判断容器是否为空 c.erase(pos) 阅读全文
posted @ 2017-10-07 08:49 楼主好菜啊 阅读(131) 评论(0) 推荐(0) 编辑
摘要: poj 2406 Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think o 阅读全文
posted @ 2017-10-05 09:35 楼主好菜啊 阅读(348) 评论(0) 推荐(0) 编辑
摘要: 推荐博客 :http://www.cnblogs.com/yjiyjige/p/3263858.html 什么是KMP 算法呢 ? KMP是三位大牛:D.E.Knuth、J.H.Morris和V.R.Pratt同时发现的。 问题 : 有两个字符串 , 一个叫模式串 , 一个叫主串 , 用模式串向主串 阅读全文
posted @ 2017-10-04 10:23 楼主好菜啊 阅读(415) 评论(0) 推荐(0) 编辑
摘要: 当有两个元素需要绑定在一起的时候可以用结构体 , 此时也可以用 pair 数组去替代结构体 。 定义 : 访问两个元素 : 通过first 和 second 访问pair 中的两个元素 赋值 用make_fair 对其进行赋初值 。 变量间的赋值 用sort 对pair 排序时 , 默认对 firs 阅读全文
posted @ 2017-09-28 15:09 楼主好菜啊 阅读(3766) 评论(1) 推荐(2) 编辑
摘要: 直接用这个函数 , 会比自己写个for 判断快的多了 。 position 代表找到最大元素的位置 , max_element( ) 的函数返回值是个指针 , 当其在减去首地址后返回的就是 所要找的元素的位置 。 这句话的意思是输出最大元素位置处的元素 , 同理 , min_element( ) , 阅读全文
posted @ 2017-09-28 14:46 楼主好菜啊 阅读(2055) 评论(1) 推荐(3) 编辑
摘要: A. Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An infinitely lo 阅读全文
posted @ 2017-09-28 14:38 楼主好菜啊 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Leyni是一个地址调查员,有一天在他调查的地方突然出现个泉眼。由于当地的地势不均匀,有高有低,他觉得如果这个泉眼不断的向外溶出水来,这意味着这里在不久的将来将会一个小湖。水往低处流,凡是比泉眼地势低或者等于的地方都会被水淹没,地势高的地方水不会越过。而且又因为泉水比较弱,当所有地势低的地方被淹没后 阅读全文
posted @ 2017-09-19 15:25 楼主好菜啊 阅读(316) 评论(0) 推荐(0) 编辑
摘要: 首尾相连数组的最大子数组和 时间限制:1000 ms | 内存限制:65535 KB 难度:4 阅读全文
posted @ 2017-09-19 08:52 楼主好菜啊 阅读(556) 评论(0) 推荐(0) 编辑
摘要: When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for 阅读全文
posted @ 2017-09-19 00:50 楼主好菜啊 阅读(183) 评论(0) 推荐(0) 编辑