08 2018 档案
High School: Become Human(数学思维)
摘要:Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve
Factorials 阶乘(思维)
摘要:Description N 的阶乘写作N!表示小于等于N的所有正整数的乘积。阶乘会很快的变大,如13!就必须用32位整数类型来存储,70!即使用浮点数也存不下了。你的任务是 找到阶乘最后面的非零位。举个例子,5!=1*2*3*4*5=120所以5!的最后面的非零位是2,7!=1*2*3*4*5*6*
数据结构——快速排序
摘要:这篇博客主要转自《啊哈!算法》http://developer.51cto.com/art/201403/430986.htm 高快省的排序算法 有没有既不浪费空间又可以快一点的排序算法呢?那就是“快速排序”啦!光听这个名字是不是就觉得很高端呢。 假设我们现在对“6 1 2 7 9 3 4 5 10
皮卡丘的梦想2(线段树+二进制状态压缩)
摘要:Description 一天,一只住在 501 实验室的皮卡丘决定发奋学习,成为像 LeiQ 一样的巨巨,于是他向镇上的贤者金桔请教如何才能进化成一只雷丘。 金桔告诉他需要进化石才能进化,并给了他一个地图,地图上有 n 个小镇,他需要从这些小镇中收集进化石。 接下来他会进行 q 次操作,可能是打听进
Heavy Cargo POJ 2263 (Floyd传递闭包)
摘要:Description Big Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the am
Fiber Network ZOJ 1967(Floyd+二进制状态压缩)
摘要:Description Several startup companies have decided to build a better Internet, called the "FiberNet". They have already installed many nodes that act
Tempter of the Bone HDU 1010(DFS+剪枝)
摘要:Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, an
The Bits (思维+找规律)
摘要:Description Rudolf is on his way to the castle. Before getting into the castle, the security staff asked him a question: Given two binary numbers aa a
win10与linux双系统切换时间不一致的调整
摘要:按照Linux系统之后再切换回到win10后,我发现win10的时间不再是北京时间,而是比北京时间多了整整8小时,之后百度找到了问题来源,这里给出解决方法。 如果安装了 Windows 和 Linux(比如 Ubuntu)双系统,有时会出现两个系统的时间不一致的情况。这是因为,两个操作系统对电脑硬件
联想电脑深度系统(deepin)与win10双系统切换设置
摘要:之前在win10下安装了深度系统,我不知道其他人在双系统切换的时候是否需要更改BIOS参数,我根据我的实际情况给出双系统切换设置的解决方案。 1.开机后进入选项System setup 2.按照下图选择参数,进入深度系统选择AHCI,进入win10选择Intel 。 3.继续选择Security—S
Segments CodeForces 909B (找规律)
摘要:Description You are given an integer N. Consider all possible segments (线段,划分)on the coordinate axis with endpoints at integer points with coordinates
逆序数
摘要:1.定义 在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。 举个例子: 标准列是1 2 3 4 5 那么 5 4 3 2 1 的逆序数算法: 看第二个,4之前有一个5,在标准列中5在4的后面,所以记1个 类
下沙的沙子有几粒?(递推)
摘要:Description 2005年11月份,我们学校参加了ACM/ICPC 亚洲赛区成都站的比赛,在这里,我们获得了历史性的突破,尽管只是一枚铜牌,但获奖那一刻的激动,也许将永远铭刻在我们几个人的心头。借此机会,特向去年为参加ACM亚洲赛而艰苦集训了近半年的各位老队员表示感谢。 实际上,除了获奖以外
杨辉三角与二项式定理
摘要:这篇博客主要参考刘汝佳的《算法竞赛入门经典》。 下面是一个杨辉三角: 我们再把(a+b)n展开,将得到一个关于x的多项式: (a+b)0 = 1 (a+b)1 = a + b (a+b)2 = a2 + 2ab + b2 (a+b)3 = a3 + 3a2b + 3ab2 + b3 (a+b)4 =
Knight Moves(广搜BFS)
摘要:Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves tha
Masha and Bears(翻译+思维)
摘要:Description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it.
Visiting a Friend(思维)
摘要:Description Pig is visiting a friend. Pig's house is located at point 0, and his friend's house is located at point m on an axis. Pig can use teleport
Python网络爬虫 第一章 入门
摘要:一、爬⾍概述 什么是爬⾍? 不知道各位是否遇到过这样的需求. 就是我们总是希望能够保存互联⽹上的⼀些重要的数据信息为⼰所⽤.⽐如, 在浏览到⼀些优秀的让⼈⾎脉喷张的图⽚时. 总想保存起来留为⽇后做桌⾯上的壁纸 在浏览到⼀些重要的数据时(各⾏各业), 希望保留下来⽇后为⾃⼰进⾏各种销售⾏为增光添彩 在
Python Requests库简单入门
摘要:我对Python网络爬虫的学习主要是基于中国慕课网上嵩天老师的讲授,写博客的目的是为了更好触类旁通,并且作为学习笔记之后复习回顾。 1.引言 requests 库是一个简洁且简单的处理HTTP请求的第三方库。 requests的最大优点是程序编写过程更接近正常URL 访问过程。 这个库建立在Pyth
Python BeautifulSoup库基础及一般元素提取方法
摘要:转载自https://www.cnblogs.com/hanmk/p/8724162.html 学习爬虫,怎么也绕不开requests库和BeautifulSoup库,先说下BeautifulSoup库: BeautifulSoup库通俗来说是【解析、遍历、维护“标签树”(例如html、xml等格式
Coloring a Tree(耐心翻译+思维)
摘要:Description You are given a rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1. Each vertex has a col
Python jieba库的使用说明
摘要:一、jieba库基本介绍 (1)、jieba库概述 jieba是优秀的中文分词第三方库 - 中文文本需要通过分词获得单个的词语 - jieba是优秀的中文分词第三方库,需要额外安装 - jieba库提供三种分词模式,最简单只需掌握一个函数 (2)、jieba分词的原理 Jieba分词依靠中文词库 -
竖式除法模拟
摘要:写这篇博客的目的是为了更好利用数学方法来处理数据,之前遇到了一道题给你a,b,c三个数问a/b小数点后几位是c,按照我的想法肯定是现将a/b的结果使用函数转换成字符串,然后直接在字符串中查找,很遗憾对于数据量较大的数根本就不能通过,还好这道水题是我队友AC通过了,这道题到我手里肯定是通不过的,那我们
Pythagorean Triples毕达哥斯拉三角(数学思维+构造)
摘要:Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triple
C++ STL中的Binary search(二分查找)
摘要:这篇博客转自爱国师哥,这里给出连接https://www.cnblogs.com/aiguona/p/7281856.html 一.解释 以前遇到二分的题目都是手动实现二分,不得不说错误比较多,关于返回值,关于区间的左闭右开等很容易出错,最近做题发现直接使用STL中的二分函数方便快捷还不会出错,不过
Polycarp and Letters(set首战!)
摘要:Description Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin lett
World Cup(思维+模拟)
摘要:Description Allen wants to enter a fan zone(球迷区) that occupies a round square and has nn entrances. There already is a queue of aiai people in front o
8月11号团队赛水题走一波
摘要: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
8月10号水题走一波-个人赛八
摘要: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
8月9号水题走一波(晚上)-个人赛七
摘要: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
Segment Occurrences(string find函数)
摘要: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
8月9号水题走一波(下午)-个人赛六
摘要:1.Sonya and Exhibition DescriptionSonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that onl
划分树
摘要: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...
树状数组怒刷sum!!!(前缀和应用)
摘要:我们知道我们利用树状数组维护的是存到其中的a[ ]数组,但是我们做题需要的是sum[ ]数组,这才是我们真正需要的有用的信息,写这篇博客的目的便是整理一下sum数组是怎么样来应用解题的。 1. Stars Astronomers often examine star maps where stars
浅谈树状数组
摘要:之前也看过了好多关于树状数组的博客,结合这几天做的题,我一直想好好总结一下树状数组,这篇文章就来浅谈一下树状数组。 1.前言 首先我们要明白树状数组是一种数据结构,利用树状数组可以以空间换取时间,这一点和之前的线段树一样,但是树状数组访问会更快,效率更高,树状数组不同于线段数的一点就是这棵树的构成。
最短路径问题大总结(提纲)
摘要:有向网或者无向网中最典型的问题就是最短路径问题(Shortest Path Problem)。最短路径问题要求解的是:如果从图中某一个定点(称为源点)到达另一顶点(称为终点)的路径可能不止一条,如何找到一条路径,使得沿着此路径各边上的权值总和(即从源点到终点的距离)达到最小,这条路径称为最短路径(S
单源最短路——Bellman-Ford算法
摘要:1.Dijkstra的局限性 Dijkstra算法是处理单源最短路径的有效算法,但它局限于边的权值非负的情况,若图中出现权值为负的边,Dijkstra算法就会失效,求出的最短路径就可能是错的。 列如以下这个例子: 在这个图中,求从A到C的最短路,如果用Dijkstra根据贪心的思想,选择与A最接近的
多源最短路——Floyd算法
摘要:Floyd算法 问题的提出:已知一个有向网(或者无向网),对每一对定点vi!=vj,要求求出vi与vj之间的最短路径和最短路径的长度。 解决该问题有以下两种方法: (1)轮流以每一个定点为源点,重复执行Dijkstra算法或者Bellman-Ford算法n次,就可以求出每一对顶点之间的最短路径和最短
Bracket Sequences Concatenation Problem括号序列拼接问题(栈+map+思维)
摘要:A bracket(括号) sequence is a string containing only characters "(" and ")".A regular bracket sequence is a bracket sequence that can be transformed int
数位DP
摘要:这篇博客转载自我的一个同学,这里给出链接https://blog.csdn.net/JKdd123456/article/details/81383012 谢谢 一、基础篇——介绍 1、概念: 数位dp是一种计数用的dp,一般就是要统计一个区间 [A , B ] 内满足一些条件数的个数。 所谓数位d
C++ string中的find()函数
摘要:1.string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,那么会返回一个特别的标记npos。(返回值可以看成是一个int型的数) 1 #include<cstring> 2 #include<cstdio> 3 #include<iostream> 4 using name
Planning The Expedition(暴力枚举+map迭代器)
摘要: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
8月3号水题走一波-个人赛五
摘要:1.Alex and broken contest Description One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problem
Walking Between Houses(贪心+思维)
摘要: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
LCA(Tarjan算法)模板
摘要:一.查询一组的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
LCA最近公共祖先(Tarjan离线算法)
摘要:这篇博客对Tarjan算法的原理和过程模拟的很详细。 转载大佬的博客https://www.cnblogs.com/JVxie/p/4854719.html 第二次更新,之前转载的博客虽然胜在详细,但其实还是对递归,集合划分,查找还是有些抽象,刚刚恰好看了千千大佬的一篇博客,他在讲解Tarjan算法
基础线段树模板
摘要:1.单点更新+区段查找 敌兵布阵 C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二
博客园鼠标点击特效代码
摘要:统一回复一下,有些网友直接复制粘贴后没有实现鼠标点击的效果,可能是没有向博客园申请js的权限,申请下来后就可以自定义自己的博客了。 <script type="text/javascript"> /* 鼠标特效 */ var a_idx = 0; jQuery(document).ready(fun
心知天气网页调用源码
摘要:最近给我的博客新加了天气预报功能,首先需要注册心知天气账号https://www.seniverse.com/widget/create 自动生成安装代码 将其复制到“设置”->“页脚Html代码”中 <script>(function(T,h,i,n,k,P,a,g,e){g=function()
8月1号水题走一波-个人赛四
摘要: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
前向星与链式前向星
摘要:这里借鉴了一些大佬的文章和代码,给出链接,谢谢 https://blog.csdn.net/ACdreamers/article/details/16902023 https://blog.csdn.net/wuhuajunbao/article/details/22589619 引言 一般来讲,图
Summarize to the Power of Two(map+思维)
摘要: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