上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 29 下一页
摘要: 1. Fair Game Description Petya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card. Be 阅读全文
posted @ 2018-08-12 21:28 王陸 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1.Brain's Photos Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postp 阅读全文
posted @ 2018-08-11 21:54 王陸 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 1.The Rank DescriptionJohn Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students 阅读全文
posted @ 2018-08-10 09:48 王陸 阅读(500) 评论(0) 推荐(0) 编辑
摘要: DescriptionYou are given two strings s and t, both consisting only of lowercase Latin letters.The substring s[l..r] is the string which is obtained by 阅读全文
posted @ 2018-08-10 08:47 王陸 阅读(1839) 评论(0) 推荐(1) 编辑
摘要: 1.Sonya and Exhibition DescriptionSonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that onl 阅读全文
posted @ 2018-08-09 18:51 王陸 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int MAXN = 1010; 7 int tree[20][MAXN]; 8 int sorted[MAXN]; 9 int toleft[20][MAXN]; 10 long long sum[2... 阅读全文
posted @ 2018-08-09 10:47 王陸 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 我们知道我们利用树状数组维护的是存到其中的a[ ]数组,但是我们做题需要的是sum[ ]数组,这才是我们真正需要的有用的信息,写这篇博客的目的便是整理一下sum数组是怎么样来应用解题的。 1. Stars Astronomers often examine star maps where stars 阅读全文
posted @ 2018-08-08 21:08 王陸 阅读(862) 评论(0) 推荐(0) 编辑
摘要: 之前也看过了好多关于树状数组的博客,结合这几天做的题,我一直想好好总结一下树状数组,这篇文章就来浅谈一下树状数组。 1.前言 首先我们要明白树状数组是一种数据结构,利用树状数组可以以空间换取时间,这一点和之前的线段树一样,但是树状数组访问会更快,效率更高,树状数组不同于线段数的一点就是这棵树的构成。 阅读全文
posted @ 2018-08-08 20:02 王陸 阅读(1484) 评论(0) 推荐(3) 编辑
摘要: 有向网或者无向网中最典型的问题就是最短路径问题(Shortest Path Problem)。最短路径问题要求解的是:如果从图中某一个定点(称为源点)到达另一顶点(称为终点)的路径可能不止一条,如何找到一条路径,使得沿着此路径各边上的权值总和(即从源点到终点的距离)达到最小,这条路径称为最短路径(S 阅读全文
posted @ 2018-08-08 14:49 王陸 阅读(2022) 评论(0) 推荐(0) 编辑
摘要: 1.Dijkstra的局限性 Dijkstra算法是处理单源最短路径的有效算法,但它局限于边的权值非负的情况,若图中出现权值为负的边,Dijkstra算法就会失效,求出的最短路径就可能是错的。 列如以下这个例子: 在这个图中,求从A到C的最短路,如果用Dijkstra根据贪心的思想,选择与A最接近的 阅读全文
posted @ 2018-08-08 10:54 王陸 阅读(1161) 评论(2) 推荐(0) 编辑
摘要: Floyd算法 问题的提出:已知一个有向网(或者无向网),对每一对定点vi!=vj,要求求出vi与vj之间的最短路径和最短路径的长度。 解决该问题有以下两种方法: (1)轮流以每一个定点为源点,重复执行Dijkstra算法或者Bellman-Ford算法n次,就可以求出每一对顶点之间的最短路径和最短 阅读全文
posted @ 2018-08-08 10:20 王陸 阅读(3424) 评论(0) 推荐(2) 编辑
摘要: A bracket(括号) sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed int 阅读全文
posted @ 2018-08-07 21:20 王陸 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 这篇博客转载自我的一个同学,这里给出链接https://blog.csdn.net/JKdd123456/article/details/81383012 谢谢 一、基础篇——介绍 1、概念: 数位dp是一种计数用的dp,一般就是要统计一个区间 [A , B ] 内满足一些条件数的个数。 所谓数位d 阅读全文
posted @ 2018-08-07 19:15 王陸 阅读(4240) 评论(1) 推荐(5) 编辑
摘要: 1.string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,那么会返回一个特别的标记npos。(返回值可以看成是一个int型的数) 1 #include<cstring> 2 #include<cstdio> 3 #include<iostream> 4 using name 阅读全文
posted @ 2018-08-06 11:00 王陸 阅读(452612) 评论(5) 推荐(106) 编辑
摘要: Description Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant. The warehouse 阅读全文
posted @ 2018-08-06 09:56 王陸 阅读(546) 评论(0) 推荐(0) 编辑
摘要: 1.Alex and broken contest Description One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problem 阅读全文
posted @ 2018-08-05 15:46 王陸 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Walking Between Houses There are nn houses in a row. They are numbered from 11 to nn in order from left to right. Initially you are in the house 11. Y 阅读全文
posted @ 2018-08-05 14:41 王陸 阅读(698) 评论(0) 推荐(1) 编辑
摘要: 一.查询一组的LCA Nearest Common Ancestors A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In th 阅读全文
posted @ 2018-08-05 14:09 王陸 阅读(1046) 评论(0) 推荐(0) 编辑
摘要: 这篇博客对Tarjan算法的原理和过程模拟的很详细。 转载大佬的博客https://www.cnblogs.com/JVxie/p/4854719.html 第二次更新,之前转载的博客虽然胜在详细,但其实还是对递归,集合划分,查找还是有些抽象,刚刚恰好看了千千大佬的一篇博客,他在讲解Tarjan算法 阅读全文
posted @ 2018-08-03 17:18 王陸 阅读(3622) 评论(1) 推荐(3) 编辑
摘要: 1.单点更新+区段查找 敌兵布阵 C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二 阅读全文
posted @ 2018-08-03 16:31 王陸 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 统一回复一下,有些网友直接复制粘贴后没有实现鼠标点击的效果,可能是没有向博客园申请js的权限,申请下来后就可以自定义自己的博客了。 <script type="text/javascript"> /* 鼠标特效 */ var a_idx = 0; jQuery(document).ready(fun 阅读全文
posted @ 2018-08-03 15:01 王陸 阅读(10334) 评论(36) 推荐(61) 编辑
摘要: 最近给我的博客新加了天气预报功能,首先需要注册心知天气账号https://www.seniverse.com/widget/create 自动生成安装代码 将其复制到“设置”->“页脚Html代码”中 <script>(function(T,h,i,n,k,P,a,g,e){g=function() 阅读全文
posted @ 2018-08-03 10:52 王陸 阅读(2786) 评论(8) 推荐(2) 编辑
摘要: A. Generate Login The preferred way to generate user login in Polygon is to concatenate a prefix of the user's first name and a prefix of their last n 阅读全文
posted @ 2018-08-02 20:38 王陸 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 这里借鉴了一些大佬的文章和代码,给出链接,谢谢 https://blog.csdn.net/ACdreamers/article/details/16902023 https://blog.csdn.net/wuhuajunbao/article/details/22589619 引言 一般来讲,图 阅读全文
posted @ 2018-08-02 15:14 王陸 阅读(900) 评论(0) 推荐(2) 编辑
摘要: A sequence a1,a2,…,ana1,a2,…,an is called good if, for each element aiai, there exists an element ajaj (i≠ji≠j) such that ai+ajai+aj is a power of two 阅读全文
posted @ 2018-08-01 17:24 王陸 阅读(540) 评论(0) 推荐(0) 编辑
摘要: 博客内容主要来自https://www.cnblogs.com/TheRoadToTheGold/p/6254255.html 感谢原博主大大,代码部分我根据我的习惯进行了更改 数据结构——线段树 1、引例 A.给出n个数,n<=100,和m个询问,每次询问区间[l,r]的和,并输出。 一种回答:这 阅读全文
posted @ 2018-07-31 18:56 王陸 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 有1000瓶药水,其中只有一瓶有毒。现在用小白鼠进行实验,小白鼠只要服用任意量有毒药水就会在24小时内死亡。问至少要用多少只小白鼠进行实验才能检测出哪瓶药水有毒? 解题思路: 给1000个瓶分别标上如下标签(10位长度): 0000000001 (第1瓶) 0000000010 (第2瓶) 0000 阅读全文
posted @ 2018-07-31 10:24 王陸 阅读(449) 评论(0) 推荐(0) 编辑
摘要: Polycarp likes to play with numbers. He takes some integer number x, writes it down on the board, and then performs with it n−1 operations of the two 阅读全文
posted @ 2018-07-30 10:40 王陸 阅读(410) 评论(0) 推荐(0) 编辑
摘要: You are given an array a consisting of n integers a1, ..., an. In one operation, you can choose 2 elements ai and aj in which ai is divisible by aj an 阅读全文
posted @ 2018-07-29 20:56 王陸 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 之前写过一篇关于map容器的一篇博客,但是只有一些基础操作,后来我在CSDN上看到了一位大佬写的博客于是转载过来了。 作者大大的博客https://blog.csdn.net/sunshinewave/article/details/8067862 ————————————————————————— 阅读全文
posted @ 2018-07-29 20:32 王陸 阅读(390) 评论(0) 推荐(0) 编辑
上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 29 下一页