01 2019 档案

【动态规划】合唱队形
摘要:题目描述n位同学站成一排,音乐老师要请其中的(n-K)位同学出列,使得剩下的K位同学排成合唱队形。合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1,2,…,K,他们的身高分别为T1,T2,…,TK,则他... 阅读全文

posted @ 2019-01-30 15:11 湫叶 阅读(509) 评论(0) 推荐(0) 编辑

线段树——D - A Simple Problem with Integers
摘要:You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operatio... 阅读全文

posted @ 2019-01-29 20:56 湫叶 阅读(78) 评论(0) 推荐(0) 编辑

线段树——E - Just a Hook
摘要:In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hoo... 阅读全文

posted @ 2019-01-29 20:15 湫叶 阅读(102) 评论(0) 推荐(0) 编辑

线段树——F - I Hate It
摘要:很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新... 阅读全文

posted @ 2019-01-28 21:08 湫叶 阅读(100) 评论(0) 推荐(0) 编辑

线段树——I - 维护序列
摘要:老师交给小可可一个维护数列的任务,现在小可可希望你来帮他完成。有长为 nn 的数列,不妨设为 a1,a2,⋯,ana1,a2,⋯,an。有如下三种操作形式:把数列中的一段数全部乘一个值; 把数列中的一段数全部加一... 阅读全文

posted @ 2019-01-28 18:52 湫叶 阅读(130) 评论(0) 推荐(0) 编辑

线段树——G - Billboard
摘要:At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and ... 阅读全文

posted @ 2019-01-28 18:45 湫叶 阅读(87) 评论(0) 推荐(0) 编辑

线段树——H - 花神游历各国
摘要:Output每次x=1时,每行一个整数,表示这次旅行的开心度 Sample Input4 1 100 5 55 1 1 22 1 2 1 1 22 2 3 1 1 4 Sample Output1011111Hi... 阅读全文

posted @ 2019-01-27 17:17 湫叶 阅读(92) 评论(0) 推荐(0) 编辑

线段树——B - Balanced Lineup
摘要:For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Far... 阅读全文

posted @ 2019-01-27 15:12 湫叶 阅读(100) 评论(0) 推荐(0) 编辑

线段树——A - 敌兵布阵
摘要:C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先... 阅读全文

posted @ 2019-01-27 13:22 湫叶 阅读(122) 评论(0) 推荐(0) 编辑

线段树———C - 区间最大值 II
摘要:给一个有n个整数的序列a1, a2, a3, ..., an,然后有q个提问,每个提问为两个整数i、j,(i#include #include using namespace std;#define N 4000... 阅读全文

posted @ 2019-01-27 10:59 湫叶 阅读(127) 评论(0) 推荐(0) 编辑

线段树
摘要:线段树是一种二叉树,它的每一个节点代表一个区间[a,b],它的叶节点代表单位区间[a,a],即点a。对一个非叶节点,设它的编号为x,区间为[a,b],那么它的左儿子的编号就是(2*x),区间是[a,(a+b)/2... 阅读全文

posted @ 2019-01-27 10:01 湫叶 阅读(108) 评论(0) 推荐(0) 编辑

非负权单源最短路
摘要:Description 给一个 nn 个点 mm 条边的无向图,求 ss 到 tt 的最短路。Input 第一行四个由空格隔开的整数 nn、mm、ss、tt 。之后 mm 行,每行三个正整数 u_iui​、v_i... 阅读全文

posted @ 2019-01-17 20:49 湫叶 阅读(111) 评论(0) 推荐(0) 编辑

The Festive Evening
摘要:题目描述It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over t... 阅读全文

posted @ 2019-01-16 18:52 湫叶 阅读(87) 评论(0) 推荐(0) 编辑

究极无敌卧槽2的幂数
摘要:文章出处:http://www.cnblogs.com/skyiv/archive/2010/03/27/1698550.html数的分解,据说是清华的一道复试上机题来源: http://topic.csdn.n... 阅读全文

posted @ 2019-01-16 18:28 湫叶 阅读(95) 评论(0) 推荐(0) 编辑

字符串常用函数
摘要:https://blog.csdn.net/fdqw_sph/article/details/54233971提取子串和字符串连接题取子串的函数是:substr(),形式如下:s.substr();//返回s的全... 阅读全文

posted @ 2019-01-15 22:32 湫叶 阅读(217) 评论(0) 推荐(0) 编辑

KMP
摘要:作用是找大串里匹配的小串的位置理解好难,先讲一下原理。找目前字符串的Border:是一个字符串最长的,能跟真后缀相同的真前缀的长度。比如ABCDABCD从1号到八号 Border分别是00001234.。如何求B... 阅读全文

posted @ 2019-01-15 22:27 湫叶 阅读(126) 评论(0) 推荐(0) 编辑

勾股数定理
摘要:一、勾股数形如 一类的数称为勾股数(a,b,c为正整数)。x^2+y^2=z^2二、一些性质1.直角三角形的两条直角边和斜边满足勾股数定理。2. .a+b>c,a-b2时,方程没有正解。 people in US... 阅读全文

posted @ 2019-01-14 18:15 湫叶 阅读(784) 评论(0) 推荐(0) 编辑

H - Happy 2004
摘要:Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is... 阅读全文

posted @ 2019-01-14 16:31 湫叶 阅读(75) 评论(0) 推荐(0) 编辑

D - Primes
摘要:Write a program to read in a list of integers and determine whether or not each number is prime. A number,... 阅读全文

posted @ 2019-01-14 10:53 湫叶 阅读(146) 评论(0) 推荐(0) 编辑

用费马小定理求逆元
摘要:费马小定理(Fermat's little theorem)是数论中的一个重要定理,在1636年提出,其内容为: 假如p是质数,且gcd(a,p)=1,那么 a^(p-1)≡1(mod p),例如:假如a是整数,... 阅读全文

posted @ 2019-01-13 20:29 湫叶 阅读(215) 评论(0) 推荐(0) 编辑

唯一分解定理
摘要:•其包括两个断言:断言1:数n可以以某种方式分解成素数乘积。• 断言2:仅有一种这样的因数分解。(除因数排 ... 阅读全文

posted @ 2019-01-13 20:11 湫叶 阅读(180) 评论(0) 推荐(0) 编辑

素数//素数筛
摘要:枚举所有小于数,看是否它能整除其他自然数,但实际上只需要枚举根号次。bool Is_prime(int n){ for(int i=1;i*i#include using namespace std;boo... 阅读全文

posted @ 2019-01-13 19:16 湫叶 阅读(103) 评论(0) 推荐(0) 编辑

摘要:题目描述乌龟家的屋顶是凹凸不平的,所以每次雨后都会积水。为了知道屋顶是否会在暴雨后塌掉,他把屋顶的形 状给了你,希望你帮他计算暴雨后屋顶的积水总量。乌龟的屋顶由顺次排在同一水平线上的 n 个宽度为 1、高度为整数... 阅读全文

posted @ 2019-01-01 23:30 湫叶 阅读(129) 评论(0) 推荐(0) 编辑

导航

点击右上角即可分享
微信分享提示