自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

许久的学习小窝

许久的学习小窝

  • 博客(58)
  • 收藏
  • 关注

原创 POJ 2406 KMP (循环节

题目链接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 of concatenation as multiplication, exponentiation by...

2018-08-17 17:11:49 140

原创 npm run dev 报错 missing script:dev

来源:https://www.cnblogs.com/andy-lehhaxm/p/10232361.html

2019-10-20 12:16:13 203

原创 vscode JavaScript

目录实时预览编写位置数据类型其他类型转换为string类1.toString ()方法2.调用 String()函数;其他数据类型转换为number1.调用Number()函数2.parseInt()/parseFloat()其他类型转布尔this使用工厂方式创建对象构造函数数组concat()push()pop()splic...

2019-08-20 14:18:29 6487

原创 拓扑排序专题 HDU - 3342

题意:给出n个人的师徒关系,判断是否存在即是某个人的师傅又是其徒弟的关系思路:用拓扑排序判断是否有环#include<bits/stdc++.h>#define maxn 1010using namespace std;bool G[maxn][maxn];int in_degree[maxn];int n,m;priority_queue<int...

2019-07-25 22:55:10 174

原创 拓扑排序专题 HDU - 1285 (裸拓扑+优先队列)

裸拓扑排序#include<bits/stdc++.h>#define maxn 517using namespace std;int G[maxn][maxn];//路径int in_degree[maxn]; //入度int ans[maxn];int n,m;void toposort(){ for(int i = 1; i <= n; ...

2019-07-25 22:54:15 173

原创 拓扑排序专题 HDU - 2647 反向建图

反向建图+判断等级就可以了#include<bits/stdc++.h>#define maxn 10005using namespace std;int in_degree[maxn],add[maxn];vector<int>G[maxn];queue<int>q;int n,m,sum=0;int toposort(){ q...

2019-07-25 22:54:08 128

原创 拓扑排序专题 POJ - 1094

•题意:对于N个大写字母,给定它们的一些偏序关系,要求判断出经过多少个偏序关系之后可以确定它们的排序或者存在冲突,或者所有的偏序关系用上之后依旧无法确定唯一的排序。•思路:题目要求的是经过多少个关系之后就可以确定答案,因此每读入一个关系,就要进行一次拓扑排序,如果某一次拓扑排序之后可以确定它们的唯一排序或者发现冲突存在,记录第几步,后面的直接略过。不唯一确定:多个点入度为0,则不知道哪...

2019-07-25 22:53:56 244

原创 拓扑排序专题 HDU - 4857 反向建图+逆向输出

•注意此题不是保证字典序,而是要最小的尽量在前面。•比如正向拓扑排序不能解决这个问题,只能反向建图再逆序输出,在拓扑排序时尽量让大数在前(优先队列)这样逆向输出后就可以保证1.2.3....尽量在前#include <iostream>#include <stdio.h>#include <string.h>#include <...

2019-07-25 22:53:33 172

原创 拓扑排序专题 POJ - 3687 反向建图+逆序输出

POJ - 3687 跟hdu 4857一样只是最后输出的不是拓扑排序数列,而是每个节点在序列中的位置输出改一下就可以了#include <iostream>#include <stdio.h>#include <string.h>#include <vector>#include <algorithm>#in...

2019-07-25 22:53:13 155

原创 网络流(持续更新)

网络流基础网络流问题相关概念:源点:有n个点,有m条有向边,有一个点很特殊,只出不进,叫做源点。 汇点:另一个点也很特殊,只进不出,叫做汇点。 容量和流量:每条有向边上有两个量,容量和流量,从i到j的容量通常用c[i,j]表示,流量则通常是f[i,j]。 最大流:通俗点解释,就好比你有很多货物要从源点点运到汇点点,有向图中的一条边代表一条公路,每条公路有固定的货物装载限制(容量)...

2019-07-24 18:00:38 185

原创 C#数组的定义及使用(一)

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ //c#数组的使用 class Program { static void Main(string[] args) ...

2019-03-11 11:44:10 31122 3

原创 【蓝桥杯】2018年第九届蓝桥杯【C++省赛B组】【第二题:明码】及bitset

标题:明码汉字的字形存在于字库中,即便在今天,16点阵的字库也仍然使用广泛。16点阵的字库把每个汉字看成是16x16个像素信息。并把这些信息记录在字节中。一个字节可以存储8位信息,用32个字节就可以存一个汉字的字形了。把每个字节转为2进制表示,1表示墨迹,0表示底色。每行2个字节,一共16行,布局是:    第1字节,第2字节    第3字节,第4字节    ....   ...

2019-01-21 15:19:28 289 2

原创 位运算

用了那么多位运算,这里总结一下把。先看常用的位运算有哪些吧:1 &amp;a&amp;b 就是a的二进制形式与b的二进制形式,相同的位置必须两个都是1,那么结果的相应位置就是1,否则就是0.那么a&amp;b有什么用呢?最简单的,我觉得最常用的就是取一个二进制的一部分出来。例如:111011010011 我要取从左到右的第2到第5位,那怎么办呢?111011010011011110...

2019-01-20 15:52:01 144

原创 【动态规划初步】最长上升子序/最长下降子序

 给出一个序列,找出不连续的最长上升/下降序列/*最长上升子序列复杂度O(n^2) */ #include&lt;iostream&gt; #include&lt;string.h&gt;#include&lt;cstdio&gt;#include&lt;queue&gt;using namespace std;int d[10005];int A[10005];in...

2019-01-19 15:53:46 269

原创 【动态规划初步】最大矩阵和 POJ1050

题目链接求一个矩阵的子矩阵最大和。这道题的基础是最大子段和。给一个序列,求最大子序和动态规划子状态当(d[i-1]&gt;0)   d[i]=d[i-1]+a[i];否则  d[i]=a[i]; int Maxarry(int a[],int n){ //最大子段和 int m=-INF; int tmp=-1; for(int i=0;i&lt;n...

2019-01-19 13:17:05 405

原创 【牛客国庆集训派对Day1】New Game!

题目链接L1 到 L2 之间连边权值 |C1−C2|  / √ A2+B2线 L 与圆 i 之间连边权值 max(0, d(Oi , L1) − ri)圆 i 与圆 j 之间连边权值 max(0, d(Oi , Oj ) − ri − rj )求 L1 到 L2 的最短路即可。 #include&lt;bits/stdc++.h&gt;#define ios1 ios::...

2019-01-19 09:54:14 209

原创 【动态规划初步】最长公共子序列

最长公共子序列,不要求连续求两个字符串最长公共子序列POJ1458/*最长公共子序列样例输入abcfbc abfcabprogramming contest abcd mnp样例输出420*/ #include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;cstr...

2019-01-18 17:56:00 152

原创 HDU - 3746 KMP (循环节

题目链接CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about...

2018-08-17 17:09:29 634

原创 POJ - 3061 Subsequence (尺取法

题目链接 A sequence of N positive integers (10 &lt; N &lt; 100 000), each of them less than or equal 10000, and a positive integer S (S &lt; 100 000 000) are given. Write a program to find the minimal ...

2018-08-17 11:17:08 442

原创 HDU - 1568 Fibonacci (斐波那契,大数取前几位

2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i&gt;=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就可以了,可是CodeStar自己又记不住...

2018-08-08 09:31:38 1243

原创 POJ - 2478 Farey Sequence (欧拉函数

题目链接The Farey Sequence Fn for any integer n with n &gt;= 2 is the set of irreducible rational numbers a/b with 0 &lt; a &lt; b &lt;= n and gcd(a,b) = 1 arranged in increasing order. The first few ar...

2018-08-07 19:23:15 324 1

原创 ZOJ 3985 String of CCPC (水,字符串判断)

题目链接                                                                                         String of CCPC                                                                Time Limit: 1 Second    ...

2018-08-07 19:04:12 163

原创 CodeForces ~ 1000B ~ Light It Up(思维,贪心,模拟)

题目链接Recently, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will turn power on at moment 0 and turn power off at moment M. Mor...

2018-08-07 17:24:34 434 4

原创 HDU - 5187 zhx's contest(快速幂,快速乘法

Problem DescriptionAs one of the most powerful brushes, zhx is required to give his juniors n problems.zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a beautif...

2018-08-07 09:57:22 390 2

原创 POJ 2407 Relatives(欧拉函数模板)

Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x &gt; 1, y &gt; 0, z &gt; 0 such tha...

2018-08-06 17:13:01 124

原创 CodeForces - 1000C Covered Points Count

You are given n segments on a coordinate line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested in eac...

2018-08-06 14:21:15 183

原创 CodeForces - 873B Balanced Substring(最长子串

题目链接 题意:子串0和1的个数相同时,成为平衡子串。求最长的平衡子串这里很巧妙的如果遇到0,当-1处理,就可以将0,1凑成一对;当时不会后来参考露露的代码。感觉很好理解#include &lt;iostream&gt;#include &lt;cstring&gt;#include &lt;string&gt;#include &lt;cstdio&gt;#incl...

2018-08-05 17:44:23 470 1

原创 卡特兰数

题目描述整个世界都在散发着恋爱的恶臭,只有spring依旧保持着单身贵族的清香。spring单身久了,煮饺子看见两个黏在一起的都要强行分开,所以在看到凸n边形的时候,总是习惯性的拆分成n-2个小三角形,毕竟第三者插足是spring最喜闻乐见的,那么给出一个凸n边形,有多少种方法能够将凸n边形分解成n-2个小三角形。输入输入一个正整数n,表示有个凸n变形  2&lt;n&lt;30...

2018-08-05 16:50:19 159 1

原创 POJ - 2785 Values whose Sum is 0(二分暴力

DescriptionThe SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . I...

2018-08-05 16:24:14 118

原创 CodeForces - 1000A T-shirts(stl)

Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from 0 to...

2018-08-05 16:09:24 165

原创 Cows POJ - 2481 (树状数组

题目链接题意:有N头牛,每只牛有一个测试值[S,E],如果对于牛i和牛j来说,它们的测验值满足下面的条件则证明牛i比牛j强壮:Si &lt;= Sj and Ej &lt;= Ei and Ei - Si &gt; Ej - Sj。现在已知每一头牛的测验值,要求输出每头牛有几头牛比其强壮。        给你一些区间,问,对于给出的每个区间,有多少个区间是完全包含它的。        先...

2018-07-27 14:49:15 151

原创 POJ - 2299 Ultra-QuickSort(树状数组求逆序数)

题目链接In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is s...

2018-07-27 11:25:41 166

原创 POJ - 2352 Stars (树状数组)

Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and...

2018-07-24 16:32:35 158 1

原创 POJ - 3616 Milking Time 挤牛奶(dp)

题目大意:奶牛Bessie在0~N时间段产奶。农夫约翰有M个时间段可以挤奶,时间段f,t内Bessie能挤到的牛奶量e。奶牛产奶后需要休息R小时才能继续下一次产奶,求Bessie最大的挤奶量。于每一次挤奶,结束时间+=休息时间.先把m次挤奶按照开始时间排个序,用dp[i]表示挤完第i个时间段的奶以后的最大挤奶量,那么有:dp[i]=max(dp[i],dp[j]+(第i次挤奶.sum)...

2018-07-23 16:19:03 524

原创 POJ - 2385 捡苹果(简单DP)

题目大意:有两颗苹果树,会一起掉苹果,某一秒一个人只能在一棵树下,移动次数有限,怎么移动可以捡取到更多的苹果(默认在1号树下)原题链接http://poj.org/problem?id=2385ac代码#include&lt;iostream&gt;#include&lt;algorithm&gt;#include&lt;cstring&gt;#include&lt;cstdi...

2018-07-23 15:15:27 327

原创 POJ 2229 Sumsets(递推

题目描述:一个数n~1e6.只能够用2的幂次(1, 2, 4….)来构成,问构成的方法有多少.原题链接http://poj.org/problem?id=2229如果i为奇数,肯定有一个1,把f[i-1]的每一种情况加一个1就得到fi,所以f[i]=f[i-1]如果i为偶数,如果有1,至少有两个,则f[i-2]的每一种情况加两个1,就得到i,如果没有1,则把分解式中的每一项除2,则...

2018-07-23 14:56:03 104

原创 树状数组

树状数组,顾名思义,树状的数组,其目的是优化区间查询和区间修改的复杂度。看图       C1 = A1  C2 = A1 + A2  C3 = A3  C4 = A1 + A2 + A3 + A4  C5 = A5  C6 = A5 + A6  C7 = A7  C8 = A1 + A2 + A3 + A4 + A5 + A6 + A7 + A8  ......

2018-07-23 14:17:30 148

原创 POJ - 3176 Cow Bowling (Dp初步,记忆化搜索递推)

The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangle like this:   7...

2018-07-20 18:12:14 175

原创 UVa 156(map)

Sample inputladder came tape soon leader acme RIDE lone Dreis peat ScAlE orb  eye  Rides dealer  NotE derail LaCeS  drIednoel dire Disk mace Rob dries# Sample outputDiskNotEderail...

2018-07-20 16:08:30 113

原创 STl容器(map)

map是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据处理能力。在map容器内部,所有数据都是有序的。比如一个班级的学生的学号和姓名存在一一映射的关系,用map可以轻易描述,(这里可以变相理解结构体,但比结构体简单的多)map&lt;int, string&gt; student;map&lt;st...

2018-07-20 15:58:27 404

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除