自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

日月

执念是一种信仰

  • 博客(20)
  • 资源 (1)
  • 收藏
  • 关注

原创 最小表示法

与最小表示法相关的问题差不多是这样的:               对于一个字符串S,求S的循环的同构字符串S’中字典序最小的一个 。(也就是说S是一个环形的字符串,可以以任意一个字符作为开始。) int getmin(char *st){ int len = strlen(st); int i, j, k; i = 0; j = 1; k = 0; while(i &...

2018-12-28 20:56:55 156

原创 扩展kmp模板

const int maxn = 5 * 1e4 + 100;char s1[maxn], s2[maxn];int ne[maxn], ex[maxn];void Getnext(char *st) //得到next数组,是把st既当成母串又当成子串{ int len = strlen(st); ne[0] = len; int i = 0; while...

2018-12-27 20:49:18 213

原创 The Battle of Chibi HDU - 5542 (dp + 树状数组 + 离散化)

Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to beat Cao Cao is to have a spy in Cao Cao's army. But all generals and...

2018-12-25 11:19:33 220

原创 Sum HDU - 4407(分解质因数 + 容斥)

XXX is puzzled with the question below: 1, 2, 3, ..., n (1<=n<=400000) are placed in a line. There are m (1<=m<=1000) operations of two kinds. Operation 1: among the x-th number to the y...

2018-12-25 09:24:36 194

原创 Sudoku HDU - 5547(dfs暴力搜)

Yi Sima was one of the best counselors of Cao Cao. He likes to play a funny game himself. It looks like the modern Sudoku, but smaller. Actually, Yi Sima was playing it different. First of all, he tr...

2018-12-25 08:38:25 367

原创 给定x属于[1, a] 和y属于[1, b],求gcd(x, y) == 1的(x, y)的数量(莫比乌斯函数)

#include <iostream>#include <cstdio>#include <cstring>using namespace std;typedef long long ll;const int maxn = 1e5 + 100;int n, tot, m;int prime[maxn], mu[maxn];bool vis...

2018-12-22 14:26:30 788

原创 筛法专题(莫比乌斯函数、欧拉函数、素数三合一)

 此筛法复杂度为O(n)级别const int maxn = 1e7 + 100;int tot;int mu[maxn], prime[maxn], phi[maxn];bool vis[maxn];void Mubius(){ phi[1] = 1; //如果不需要筛欧拉函数的话所有的计算phi[i]的步骤都删去即可 mu[1] = 1; //求莫比乌斯函...

2018-12-22 10:43:54 489

原创 Codeforces Round #527 (Div. 3) F. Tree with Maximum Cost (树形dp)

You are given a tree consisting exactly of 

2018-12-20 10:59:40 244

原创 Computer HDU - 2196 (树形dp)

A school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Ma...

2018-12-18 11:31:00 173

原创 Information Disturbing HDU - 3586(树形dp + 二分查找)

In the battlefield , an effective way to defeat enemies is to break their communication system. The information department told you that there are n enemy soldiers and their network which have n-1 co...

2018-12-18 11:10:19 153

原创 Number of Connected Components UVALive - 7638(并查集 + 唯一分解)

Given N nodes, each node is labeled with an integer between 1 and 106 (inclusive and labels are not necessarily distinct). Two nodes have an edge between them, if and only if the GCD (Greatest Common ...

2018-12-18 08:41:32 237

原创 求图的最小环

说到求图的最小环,比较常见的是Floyed求,复杂度为O(n^3),比较费时。再优一点的,枚举所有边,每次删去一条边(u, v),然后从u开始跑Dijkstra(用堆或者c++中优先队列优化的)求u到v的距离再加上(u, v)的权值,枚完玩所有边就得出答案了,复杂度为O(m * n * logn)。然而这样的复杂度还是不令人满意。看了好多博客,倒是发现了一个比较优的方法,我们先求所给图的最小生...

2018-12-14 21:07:46 4054 7

原创 K-inversions URAL - 1523 (dp + 线段树优化)

 Consider a permutation a 1, a 2, …, an (all ai are different integers in range from 1 to n). Let us call k-inversion a sequence of numbers i 1, i 2, …, ik such that 1 ≤  i 1 <  i 2 < … <  ...

2018-12-11 09:00:23 300

原创 Ice Cream Tower Gym - 101194D (二分答案、贪心检验)

题目:传送门Solution:二分答案和贪心检验就是这道题思路的核心,我来详细介绍一下其中的过程,直接算可以制造冰激凌的数量的话很困难,我感觉主要是有一个k的存在使得直接计算不好去想(我是不会的。。),但是检验的话就很好操作了,我们可以用二分的方法去一步一步缩小答案区间,最后就可以找到最大值了。那么该如何检验呢?为了使得数量最大,我们每次肯定挑最小的那个放在顶层,然后找它的下面一层。举...

2018-12-10 18:55:16 232

原创 求逆元的几种方法

1.费马小定理:x的逆元等于x的mod - 2次方(要保证x与mod互质)2.扩展欧几里得:#include <iostream> using namespace std; int exgcd(int a, int b, int &x, int &y) ///“&x”,对x的引用,在函数里面也可更改x值,而不仅仅是更改原先值的副本{...

2018-12-08 15:43:04 2756

原创 A New Function (LightOJ - 1098) || (UVA 10830) (带一点思维的数论)

We all know that any integer number n is divisible by 1 and n. That is why these two numbers are not the actual divisors of any numbers. The function SOD(n) (sum of divisors) is defined as the summati...

2018-12-07 19:53:10 368

转载 字符编码(python~~转)

https://www.cnblogs.com/alex3714/articles/7550940.html

2018-12-06 16:41:04 100

原创 Preparing for Merge Sort CodeForces - 847B (二分)

Ivan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing ...

2018-12-04 08:19:13 141

原创 GCD HDU - 1695 (容斥原理 + 欧拉函数)

Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you're...

2018-12-03 16:38:42 221

原创 How many integers can you find HDU - 1796 (容斥原理)

  Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-integer...

2018-12-01 10:32:48 267

echarts.zip

echarts的js文件,在官网上下载麻烦,经常加载不出来

2020-07-04

空空如也

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

TA关注的人

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