07 2018 档案

摘要:1.解决动态前缀和问题 2.区间加/单点查询问题 3.区间最值问题(更推荐线段树去做 阅读全文
posted @ 2018-07-30 10:37 Roni_i 阅读(108) 评论(0) 推荐(0) 编辑
摘要:题目描述 Farmer John's N (1 include include include include include include include include include include include include include typedef long long ll; 阅读全文
posted @ 2018-07-28 16:38 Roni_i 阅读(378) 评论(0) 推荐(0) 编辑
摘要:【已知先序、中序求后序排列】——字符串类型 " 1049 : 后序遍历" 【分析】:在注释里面。 include include include include include include include include include include include include inclu 阅读全文
posted @ 2018-07-27 22:51 Roni_i 阅读(348) 评论(0) 推荐(0) 编辑
摘要:``` include include include include include include include include include include include include include include include include define debug() put 阅读全文
posted @ 2018-07-27 09:02 Roni_i 阅读(147) 评论(0) 推荐(0) 编辑
摘要:交换元素使序列有序求最少交换次数的题有两类,第一种是只能交换相邻元素使序列有序,求最小交换次数,假如是是序列升序,只需要求逆序对数。第二种是可以交换任意两个位置的元素,使之有序,求最小交换次数,答案是数字的个数减去交换数字形成的环(置换环)的个数。比如 {5 1 3 2 4 7 6 8 } ,求将这 阅读全文
posted @ 2018-07-27 08:31 Roni_i 阅读(1586) 评论(0) 推荐(0) 编辑
摘要:"视频观察" 汉诺塔永远只有三步: 图中是最常见的五层(五珠)汉诺塔,其实几层都是一样,这里设为n,冰箱门永远是汉诺塔上面的m=n 1层。那么问题来了,怎样把冰箱门打开?即:怎样把图中的1至4号串珠从A柱移动到B柱?(三根柱子从左至右依次为A、B、C,五颗串珠从小到大依次为1到5)这又变成了一道m层 阅读全文
posted @ 2018-07-26 15:46 Roni_i 阅读(688) 评论(0) 推荐(0) 编辑
摘要:求给出第 K (0 2) 她的前几项如下: DP关键在于找到状态转移方程,而找方程关键在于找状态。我们从限制条件开始构造状态。以位数N和K构造是不现实的,数据量太多,我们可以位数为N的二进制数的个数作为状态,这样如果第i位填0则f[i] = f[i 1] 如果第i位填1则第i 1位只能填0,此时f[ 阅读全文
posted @ 2018-07-26 14:55 Roni_i 阅读(297) 评论(0) 推荐(0) 编辑
摘要:"题目链接" 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 Input 第一行是测试数据的数目t(0 m:必定有n m个盘子永远空着,去掉它们对摆放苹果方法数目不产生影响。即if(n m) f(m,n) = f 阅读全文
posted @ 2018-07-26 14:47 Roni_i 阅读(226) 评论(0) 推荐(0) 编辑
摘要:``` 描述 说起佐罗,大家首先想到的除了他脸上的面具,恐怕还有他每次刻下的“Z”字。我们知道,一个“Z”可以把平面分为2部分,两个“Z”可以把平面分为12部分,那么,现在的问题是:如果平面上有n个“Z”,平面最多可以分割为几部分呢? 说明1:“Z”的两端应看成射线; 说明2:“Z”的两条射线规定为 阅读全文
posted @ 2018-07-26 12:52 Roni_i 阅读(550) 评论(0) 推荐(0) 编辑
摘要:递推算法之平面分割问题总结 这是一类问题,首先由直线划分区域到折线划分区域,再延伸到封闭图形划分区域,最后在推广为平面划分空间的问题。 一、n条直线最多分平面问题 题目大致如:n条直线,最多可以把平面分为多少个区域。 析:可能你以前就见过这题目,这充其量是一道初中的思考题。当有n 1条直线时,平面最 阅读全文
posted @ 2018-07-26 12:33 Roni_i 阅读(851) 评论(0) 推荐(0) 编辑
摘要:世界的每个地区都有自己的本地时间,在Internet及无线电通信时,时间的统一非常重要! 整个地球分为二十四时区,每个时区都有自己的本地时间。在国际无线电通信中,为统一而普遍使用一个标准时间,称为通用协调时(UTC, Universal Time Coordinated)。UTC与格林尼治平均时(G 阅读全文
posted @ 2018-07-25 14:13 Roni_i 阅读(901) 评论(0) 推荐(0) 编辑
摘要:"题目链接" [A Tricky Sum ] In this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in t 阅读全文
posted @ 2018-07-25 11:10 Roni_i 阅读(213) 评论(0) 推荐(0) 编辑
摘要:题目描述 Farmer John建造了一个有N(2 include include include include include include include include include include include include include include include incl 阅读全文
posted @ 2018-07-25 09:04 Roni_i 阅读(303) 评论(0) 推荐(0) 编辑
摘要:题目描述 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石。组委会已经选择好了两块岩石作为比赛起点和终点。在起点和终点之间,有 NN 块岩石(不含起点和终点的岩石)。在比赛过程中,选手们将从起点出发,每一步跳向相邻的岩石,直至到达终点。 为了提高比赛难度,组委会计划移走一些岩石,使得选手们 阅读全文
posted @ 2018-07-24 21:57 Roni_i 阅读(276) 评论(0) 推荐(0) 编辑
摘要:题目描述 陶陶是个贪玩的孩子,他在地上丢了A个瓶盖,为了简化问题,我们可以当作这A个瓶盖丢在一条直线上,现在他想从这些瓶盖里找出B个,使得距离最近的2个距离最大,他想知道,最大可以到多少呢? 输入输出格式 输入格式: 第一行,两个整数,A,B。(B const double eps = 1e 8; 阅读全文
posted @ 2018-07-24 18:05 Roni_i 阅读(307) 评论(0) 推荐(0) 编辑
摘要:题目描述 有N条绳子,它们的长度分别为Li。如果从它们中切割出K条长度相同的 绳子,这K条绳子每条最长能有多长?答案保留到小数点后2位。 输入输出格式 输入格式: 第一行两个整数N和K,接下来N行,描述了每条绳子的长度Li。 输出格式: 切割后每条绳子的最大长度。 输入输出样例 输入样例 1: 4 阅读全文
posted @ 2018-07-24 17:25 Roni_i 阅读(554) 评论(0) 推荐(1) 编辑
摘要:题目描述 话说KC和SH在福州的时候常常跑去85°C喝咖啡或者其他的一些什么东西。 这天,KC想要喝一杯咖啡,服务员告诉他,现在有n种调料,这杯咖啡只可以加入其中的m种(当然KC一定会加入m种,不会加入少于m种的调料),根据加入的调料不同,制成这杯咖啡要用的时间也不同,得到的咖啡的美味度也不同。 K 阅读全文
posted @ 2018-07-24 16:48 Roni_i 阅读(300) 评论(0) 推荐(0) 编辑
摘要:【代码】: include const double eps = 1e 8; const int maxn = 1e6+5; define inf 0x3f3f3f3f define ll long long using namespace std; int n,m; int a[maxn]; in 阅读全文
posted @ 2018-07-24 15:52 Roni_i 阅读(265) 评论(0) 推荐(0) 编辑
摘要:914 Yougth的最大化 内存限制:64MB 时间限制:1000ms 特判: No 通过数:3 提交数:4 难度:4 题目描述: Yougth现在有n个物品的重量和价值分别是Wi和Vi,你能帮他从中选出k个物品使得单位重量的价值最大吗? 输入描述: 有多组测试数据 每组测试数据第一行有两个数n和 阅读全文
posted @ 2018-07-24 14:15 Roni_i 阅读(336) 评论(0) 推荐(0) 编辑
摘要:Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. In total there are n piles of boxes, 阅读全文
posted @ 2018-07-24 13:53 Roni_i 阅读(284) 评论(0) 推荐(0) 编辑
摘要:Now,given the equation 8 x^4 + 7 x^3 + 2 x^2 + 3 x + 6 == Y,can you find its solution between 0 and 100; Now please try your lucky. Input The first li 阅读全文
posted @ 2018-07-24 09:40 Roni_i 阅读(216) 评论(0) 推荐(0) 编辑
摘要:Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, whic 阅读全文
posted @ 2018-07-24 09:00 Roni_i 阅读(211) 评论(0) 推荐(0) 编辑
摘要:√√第一部分 基础算法( 10023 除外) 第 1 章 贪心算法 √√ 10000 「一本通 1.1 例 1」活动安排 √√ 10001 「一本通 1.1 例 2」种树 √√ 10002 「一本通 1.1 例 3」喷水装置 √√ 10003 「一本通 1.1 例 4」加工生产调度 √√ 10004 阅读全文
posted @ 2018-07-23 17:19 Roni_i 阅读(1290) 评论(0) 推荐(3) 编辑
摘要:B. The Festive Evening time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output It's the end of July – 阅读全文
posted @ 2018-07-23 16:10 Roni_i 阅读(196) 评论(0) 推荐(0) 编辑
摘要:C. Little Girl and Maximum Sum time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The little gi 阅读全文
posted @ 2018-07-23 15:39 Roni_i 阅读(198) 评论(0) 推荐(0) 编辑
摘要:【题意】:给你n个可重叠区间和一个参考值k,然后进行q次询问,每次询问也是一个区间,问你该区间中有多少个整数在n个区间中出现次数 =k include include include include include include include include include include in 阅读全文
posted @ 2018-07-23 14:26 Roni_i 阅读(279) 评论(0) 推荐(0) 编辑
摘要:差分有:一维差分、多维差分、树上差分 差分标记一般求离线区间问题!(修改完后不再修改,然后修改结束后查询) 对于带有“将一段区间内的每个数全部加上某个值”这种操作的题目,通常考虑差分原数列以简化情况,将对一段区间的操作转化为对某两个特定数的操作。 我们可以用树状数组来维护一个差分序列。差分序列的本质 阅读全文
posted @ 2018-07-23 14:04 Roni_i 阅读(807) 评论(0) 推荐(0) 编辑
摘要:题目背景 此题约为NOIP提高组Day2T1难度。 题目描述 在n\ n的格子上有m个地毯。 给出这些地毯的信息,问每个点被多少个地毯覆盖。 输入输出格式 输入格式: 第一行,两个正整数n、m。意义如题所述。 接下来m行,每行两个坐标(x1,y1)和(x2,y2),代表一块地毯,左上角是(x1,y1 阅读全文
posted @ 2018-07-23 13:30 Roni_i 阅读(2548) 评论(0) 推荐(0) 编辑
摘要:N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a using namespace std; define ll long long const int maxn = 2e5 + 10; int n; int a,b; int x[maxn],p[maxn]; in 阅读全文
posted @ 2018-07-23 08:24 Roni_i 阅读(304) 评论(0) 推荐(0) 编辑
摘要:这里的关键就是区间加的时候是整个区间 同时 加某个数,所以这个 区间内的公差 还是不变的 阅读全文
posted @ 2018-07-23 00:53 Roni_i 阅读(429) 评论(0) 推荐(0) 编辑
摘要:dfs序七个经典问题 参考自:《数据结构漫谈》 许昊然 dfs序是树在dfs先序遍历时的序列,将树形结构转化成序列问题处理。 dfs有一个很好的性质:一棵子树所在的位置处于一个连续区间中。 ps:deep[x]为x的深度,l[x]为dfs序中x的位置,r[x]为dfs序中x子树的结束位置 1.点修改 阅读全文
posted @ 2018-07-22 19:07 Roni_i 阅读(365) 评论(0) 推荐(0) 编辑
摘要:You are given an array d1,d2,…,dn consisting of n integer numbers. Your task is to split this array into three parts (some of which may be empty) in s 阅读全文
posted @ 2018-07-22 16:12 Roni_i 阅读(289) 评论(0) 推荐(0) 编辑
摘要:1.POJ上G++只能用 %f,C++可以%lf 2.连续区间异或和最大,我只会一个套路,就是01字典树了! 3.行和列是无关的,因此有时候可以把棋盘原题分解成两个一维问题。r[N]、c[N]... 4.线段树:当前区间加上了懒惰标记的值实际上加的值是lazy_tag 区间长度 5.线段树:成段更新 阅读全文
posted @ 2018-07-22 15:45 Roni_i 阅读(257) 评论(0) 推荐(0) 编辑
摘要:Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a1,a2,…,an, respectively. His plan is to practice for 阅读全文
posted @ 2018-07-22 15:36 Roni_i 阅读(385) 评论(0) 推荐(0) 编辑
摘要:Polycarp has n coins, the value of the i th coin is ai. It is guaranteed that all the values are integer powers of 2 (i.e. ai=2d for some non negative 阅读全文
posted @ 2018-07-22 00:18 Roni_i 阅读(364) 评论(0) 推荐(0) 编辑
摘要:``` The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and 阅读全文
posted @ 2018-07-21 23:23 Roni_i 阅读(328) 评论(0) 推荐(0) 编辑
摘要:``` You are given three integers a, b and x. Your task is to construct a binary string s of length n=a+b such that there are exactly a zeroes, exactly 阅读全文
posted @ 2018-07-21 22:42 Roni_i 阅读(247) 评论(0) 推荐(0) 编辑
摘要:A sequence a1,a2,…,an is called good if, for each element ai, there exists an element aj (i≠j) such that ai+aj is a power of two (that is, 2d for some 阅读全文
posted @ 2018-07-21 21:40 Roni_i 阅读(249) 评论(0) 推荐(0) 编辑
摘要:You are given two strings s and t. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a 阅读全文
posted @ 2018-07-21 20:58 Roni_i 阅读(260) 评论(0) 推荐(0) 编辑
摘要:Little girl Tanya climbs the stairs inside a multi storey building. Every time Tanya climbs a stairway, she starts counting steps from 1 to the number 阅读全文
posted @ 2018-07-21 20:52 Roni_i 阅读(196) 评论(0) 推荐(0) 编辑
摘要:Maxim wants to buy some games at the local game shop. There are n games in the shop, the i th game costs ci. Maxim has a wallet which can be represent 阅读全文
posted @ 2018-07-21 17:17 Roni_i 阅读(239) 评论(0) 推荐(0) 编辑
摘要:Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 62103 Accepted: 29005 Case Time Limit: 2000MS Description For the daily mil 阅读全文
posted @ 2018-07-17 16:15 Roni_i 阅读(175) 评论(0) 推荐(0) 编辑
摘要:我们知道,BFS是往广处去搜索,我们把这想象成一个以起点为圆心的一个圆,每向前走一步,就是圆的半径增大一个单位,而圆的每个单位面积上是一种状态,当圆增大到目标点那么大时,找到了答案,搜索结束。那么显然的,当半径较大时,每走一步就会有十分大量的状态需要来储存( S=πr² )。通常的,我们用“判重”的 阅读全文
posted @ 2018-07-14 23:41 Roni_i 阅读(516) 评论(0) 推荐(0) 编辑
摘要:本题有写法好几个写法,但主要思路是BFS: No。1 采用双向宽搜,分别从起始态和结束态进行宽搜,暴力判重。如果只进行单向会超时。 No。2 采用hash进行判重,宽搜采用单向就可以AC。 No。3 运用康拓展开进行判重,即使采用单向宽搜时间效率也很高。 哈希是想到了,但是我们应该选择什么哈希函数呢 阅读全文
posted @ 2018-07-14 21:57 Roni_i 阅读(234) 评论(0) 推荐(0) 编辑
摘要:康托展开(有关全排列) 康托展开:已知一个排列,求这个排列在全排列中是第几个 康托展开逆运算:已知在全排列中排第几,求这个排列 定义: X=an (n 1)!+an 1 (n 2)!+...+ai (i 1)!+...+a2 1!+a1 0! ai为整数,并且0康托展开有啥用呢? 维基:n位(0~n 阅读全文
posted @ 2018-07-14 20:12 Roni_i 阅读(526) 评论(0) 推荐(0) 编辑
摘要:``` A计划 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 28414 Accepted Submission(s): 7129 Probl 阅读全文
posted @ 2018-07-12 20:09 Roni_i 阅读(164) 评论(0) 推荐(0) 编辑
摘要:【题意】:一个人要逃离迷宫,迷宫中有多处起火了。问能否逃出迷宫,能输出最小步数,不能输出"IMPOSSIBLE"。迷宫的 边缘 都是出口。 【分析】:双点BFS,火和人同时进行BFS即可。注意首先火源不只一处,可以有多处,那么我们就要把每处火都数组记录下来,然后bfs搜索前让火源全部入队,还有就是不 阅读全文
posted @ 2018-07-12 18:03 Roni_i 阅读(186) 评论(0) 推荐(0) 编辑
摘要:``` Fat brother and Maze are playing a kind of special (hentai) game on an N M board (N rows, M columns). At the beginning, each grid of this board is 阅读全文
posted @ 2018-07-12 08:58 Roni_i 阅读(175) 评论(0) 推荐(0) 编辑
摘要:非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22067 Accepted Submission(s): 8968 Problem 阅读全文
posted @ 2018-07-12 07:36 Roni_i 阅读(347) 评论(0) 推荐(0) 编辑
摘要:Find a way Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 22390 Accepted Submission(s): 7304 Pr 阅读全文
posted @ 2018-07-11 15:58 Roni_i 阅读(227) 评论(0) 推荐(0) 编辑
摘要:题目描述 如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度。 输入输出格式 输入格式: 第一行包含三个整数N、M、S,分别表示点的个数、有向边的个数、出发点的编号。 接下来M行每行包含三个整数Fi、Gi、Wi,分别表示第i条有向边的出发点、目标点和长度。 输出格式: 一行,包含N个用空 阅读全文
posted @ 2018-07-11 01:10 Roni_i 阅读(205) 评论(0) 推荐(0) 编辑
摘要:(POJ)[http://poj.org/problem?id=2387] Til the Cows Come Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 69789 Accepted: 23386 Descript 阅读全文
posted @ 2018-07-11 00:05 Roni_i 阅读(251) 评论(0) 推荐(0) 编辑
摘要:Input 5 7 1 2 2 3 3 4 1 3 4 1 1 5 4 5 output 1 5 3 4 2 include using namespace std; const int maxn = 150; const int maxm = 1050; int n, m;//顶点数,边数 int 阅读全文
posted @ 2018-07-10 22:13 Roni_i 阅读(600) 评论(0) 推荐(0) 编辑
摘要:我们首先来看一下什么是前向星. 前向星是一种特殊的边集数组,我们把边集数组中的每一条边按照起点从小到大排序,如果起点相同就按照终点从小到大排序, 并记录下以某个点为起点的所有边在数组中的起始位置和存储长度,那么前向星就构造好了. 用len[i]来记录所有以i为起点的边在数组中的存储长度. 用head 阅读全文
posted @ 2018-07-10 22:10 Roni_i 阅读(800) 评论(1) 推荐(0) 编辑
摘要:题目描述 Description 有两个无刻度标志的水壶,分别可装 x 升和 y 升 ( x,y 为整数且均不大于 100 )的水。设另有一水 缸,可用来向水壶灌水或接从水壶中倒出的水, 两水壶间,水也可以相互倾倒。已知 x 升壶为空 壶, y 升壶为空壶。问如何通过倒水或灌水操作, 用最少步数能在 阅读全文
posted @ 2018-07-10 11:22 Roni_i 阅读(458) 评论(0) 推荐(0) 编辑
摘要:Shuffle'm Up Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14471 Accepted: 6633 Description A common pastime for poker players at a poker 阅读全文
posted @ 2018-07-08 20:27 Roni_i 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Prime Path Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 26475 Accepted: 14555 Description The ministers of the cabinet were quite upset 阅读全文
posted @ 2018-07-08 18:29 Roni_i 阅读(312) 评论(0) 推荐(0) 编辑
摘要:Maya Calendar Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 82431 Accepted: 25319 Description During his last sabbatical, professor M. A. 阅读全文
posted @ 2018-07-07 22:32 Roni_i 阅读(216) 评论(0) 推荐(0) 编辑
摘要:"链接6081" 度度熊的王国战略 Time Limit: 40000/20000 MS (Java/Others) Memory Limit: 32768/132768 K (Java/Others) Total Submission(s): 923 Accepted Submission(s): 阅读全文
posted @ 2018-07-04 02:23 Roni_i 阅读(304) 评论(0) 推荐(0) 编辑
摘要:"链接" 最大的位或 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3589 Accepted Submission(s): 1369 Pro 阅读全文
posted @ 2018-07-04 01:23 Roni_i 阅读(738) 评论(0) 推荐(0) 编辑
摘要:``` #include using namespace std; const int N = 1e6,INF = 0x3f3f3f3f; int a[N]; int n,x; void fun(int n) { int left = 0, right = n-1; while(left x) { right--; } ... 阅读全文
posted @ 2018-07-02 12:42 Roni_i 阅读(353) 评论(0) 推荐(0) 编辑
摘要:0103 最短Hamilton路径 0x00「基本算法」例题 描述 给定一张 n(n≤20) 个点的带权无向图,点从 0~n 1 标号,求起点 0 到终点 n 1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n 1 不重不漏地经过每个点恰好一次。 输入格式 第一行一个整数n 阅读全文
posted @ 2018-07-02 00:59 Roni_i 阅读(427) 评论(0) 推荐(1) 编辑
摘要:描述 求 a 乘 b 对 p 取模的值,其中 1≤a,b,p≤10^18。 输入格式 第一行a,第二行b,第三行p。 输出格式 一个整数,表示a b mod p的值。 样例输入 2 3 9 样例输出 6 阅读全文
posted @ 2018-07-02 00:04 Roni_i 阅读(146) 评论(0) 推荐(0) 编辑
摘要:描述 求 a 的 b 次方对 p 取模的值,其中 1≤a,b,p≤10^9 输入格式 三个用空格隔开的整数a,b和p。 输出格式 一个整数,表示a^b mod p的值。 样例输入 2 3 9 样例输出 8 阅读全文
posted @ 2018-07-02 00:01 Roni_i 阅读(184) 评论(0) 推荐(0) 编辑
摘要:"CF" 【题意】:圆形球场有n个门,Allen想要进去看比赛。Allen采取以下方案进入球场:开始Allen站在第一个门,如果当前门前面有人Allen会花费单位时间走到下一个门,如果没人Allen从这个门就进去了。球场的每个门,每单位时间可以进去一个人。问Allen最终是从哪个门进入球场的? 【分 阅读全文
posted @ 2018-07-01 23:41 Roni_i 阅读(211) 评论(0) 推荐(0) 编辑

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