自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(231)
  • 收藏
  • 关注

转载 KMP详解

https://www.cnblogs.com/ZuoAndFutureGirl/p/9028287.html

2019-09-25 12:39:17 293

原创 高斯消元

//高斯消元 时间复杂度O(n^3) 使用浮点数计算#include<iostream>#include<string.h>#include<math.h>using namespace std;const double eps=1e-8;const int maxn=101;double a[maxn][maxn];bool l[maxn];...

2019-08-20 16:54:11 243

原创 w

#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=100010;int a[maxn],dp[maxn][2];vector<int>G[maxn];void DFS(int u,int pre){ for(int i=0;i<G[u]....

2019-08-05 11:59:16 209

原创 KMP

#include <stdio.h>#include <stdlib.h>#include<map>#include<algorithm>#include<iostream>#include<bits/stdc++.h>using namespace std;typedef long long ll;cons...

2019-07-26 19:46:58 126

原创 博客园地址

https://www.cnblogs.com/cherish-lin/

2019-06-12 22:18:30 778

原创 E - A New Function LightOJ - 1098

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...

2019-05-22 19:35:02 256

原创 D - Nim POJ - 2068 (记忆化搜索)

Let's play a traditional game Nim. You and I are seated across a table and we have a hundred stones on the table (we know the number of stones exactly). We play in turn and at each turn, you or I can ...

2019-05-18 19:54:52 133

原创 D. Almost All Divisors

We guessed some integer numberxx. You are given a list ofalmost allits divisors.Almost allmeans that there areall divisors except11andxxin the list.Your task is to find the minimum possible...

2019-05-16 22:45:48 573

原创 A - Beautiful numbers CodeForces - 55D

Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with...

2019-05-14 21:54:11 143

原创 E - Round Numbers POJ - 3252

The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) in order to make...

2019-05-14 21:35:36 153

原创 B2. Cat Party (Hard Edition)(思维)

This problem is same as the previous one, but has larger constraints.Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her ...

2019-05-10 17:53:49 318

原创 E - Equal Numbers Gym - 101612E

题目链接:http://codeforces.com/gym/101612/attachments题解:给出来n个数,进行i次操作使得进行i次操作后剩得的不同数字个数最少,注意这n次操作是最优值,这n次操作可能不连续!!!那么我们就想可以在原数组内变,如果一个数是另一个数的倍数,那么将另一个数变为该数,不同值就减少1,注意贪心从个数最少的数开始变。还有就是统一变成这n个数的最小公倍数(默认...

2019-05-08 22:05:18 206

原创 L - Little Difference Gym - 101612L(二分答案)

题目链接:http://codeforces.com/gym/101612/attachments题解:先考虑到特殊情况:如果该数是n的次幂的话,肯定能分解成任意个1与对应个2的乘积,此时输出-1。在考虑下题意,该数只能被分解成a^len或a^i*(a+1)*(len-i),由于n达到1e18,与2的60次方接近,即分解式中最多包含60位左右,不妨枚举到64,那么我们可以二分每个分解...

2019-05-08 20:17:39 258

原创 F. Graph Without Long Directed Paths

You are given a connected undirected graph consisting of

2019-05-03 22:06:09 170

原创 C. Division and Union

There are

2019-05-03 21:54:26 307

原创 C. Match Points(二分答案)

You are given a set of pointsx1x1,x2x2, ...,xnxnon the number line.Two pointsiiandjjcan be matched with each other if the following conditions hold:neitheriinorjjis matched with any ot...

2019-05-02 22:04:13 519

原创 G - Green-Red Tree Gym - 102190G

题目链接:http://codeforces.com/gym/102190/attachments题解:我们先将前5个点分别涂上红色或者绿色,使得这两棵树在5个点中都是连通,并不存在自环。那么从第6个点开始:分别找一个固定的点与该点连边即可。自己看别人做的方法,才自己做出来的,也是思考了一下,下面来张自己手动模拟的图,自己模拟一遍就会了呀#include<bits/stdc...

2019-05-02 10:53:35 169

原创 C - 不要62 HDU - 2089

杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之列。你...

2019-05-01 20:47:41 134

原创 I - Induced Metric Space Gym - 102190I

题目链接:http://codeforces.com/gym/102190/attachments题解:先按照题目要求遍历一下数组,若存在不满足题目要求的直接输出NO,其他的:先将主对角线上的元素变为0,若存在对称方面,如果一方面可变化一方面固定,则另一方面可以随之确定,而如果两面都是可变化(-1),那么将这个点变为10000000,随之跑一波Floyd找解,(如果存在不可变化的点,也能在此过...

2019-05-01 19:59:09 162

原创 E. Minimum Array(multiset暴力)

You are given two arraysaaandbb, both of lengthnn. All elements of both arrays are from00ton−1n−1.You can reorder elements of the arraybb(if you want, you may leave the order of elements as...

2019-04-29 22:26:31 420 2

原创 I - Interesting Numbers URAL - 2070

Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting if the amount of it...

2019-04-24 19:24:25 208

原创 C. Serval and Parenthesis Sequence(合法括号序列)

Serval soon said goodbye to Japari kindergarten, and began his life in Japari Primary School.In his favorite math class, the teacher taught him the following interesting definitions.Aparenthesis ...

2019-04-22 09:04:02 678

原创 P - A Dangerous Maze (II) (期望)

You are in a maze; seeingndoors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.If you choose theithdoor, it can either...

2019-04-20 23:35:47 209

原创 R - Race to 1 (期望)

Dilu have learned a new thing about integers, which is - any positive integer greater than 1 can be divided by at least one prime number less than or equal to that number. So, he is now playing with t...

2019-04-20 23:08:33 250

原创 C. Problem for Nazar(奇偶性质)

Nazar, a student of the scientific lyceum of the Kingdom of Kremland, is known for his outstanding mathematical abilities. Today a math teacher gave him avery difficult task.Consider two infinite s...

2019-04-19 23:22:17 320

原创 E. Two Teams

There arennstudents standing in a row. Two coaches are forming two teams — the first coach chooses the first team and the second coach chooses the second team.Theii-th student has integer program...

2019-04-17 22:01:09 210

原创 G - Dice (III)

Given a dice withnsides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dic...

2019-04-16 11:43:31 252

原创 E - Birthday Paradox

Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there are23people including you. What is the probability...

2019-04-16 11:30:43 230

原创 G - Seven-Segment Display (思维)

A seven segment display, or seven segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Seven segmen...

2019-04-15 09:00:21 276

原创 L - Tic-Tac-Toe

Kim likes to play Tic-Tac-Toe.Given a current state, and now Kim is going to take his next move. Please tell Kim if he can win the game in next 2 moves if both player are clever enough.Here “next ...

2019-04-13 12:22:14 255

原创 K - Wand(组合数+错排公式)

N wizards are attending a meeting. Everyone has his own magic wand. N magic wands was put in a line, numbered from 1 to n(Wand_i owned by wizard_i). After the meeting, n wizards will take a wand one b...

2019-04-12 23:02:33 305

原创 B - Triangles (计算几何)

This is a simple problem. Given two triangles A and B, you should determine they are intersect, contain or disjoint. (Public edge or point are treated as intersect.)InputFirst line contains an int...

2019-04-12 19:02:27 406

原创 XYZZY(SPFA判正环)

It has recently been discovered how to run open-source software on the Y-Crate gaming device. A number of enterprising designers have developed Advent-style games for deployment on the Y-Crate. Your j...

2019-04-11 11:05:32 348

原创 HDU Today(最短路)

经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,却一定要与...

2019-04-10 23:32:47 99

原创 K - Highway Project

Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the capital as fast as possible. Thus, he proposed the highway project.The...

2019-04-10 00:18:26 263

原创 D - XOR Permutations

A bitwise XOR takes two bit patterns of equal length and performs the logical exclusive OR operation on each pair of corresponding bits. The result in each position is11if both bits are different (o...

2019-04-09 13:03:46 606

原创 L - Median (矩阵前缀和+二分)

You are given a grid g consisting of n rows each of which is divided into m columns. The grid contains unique values between 1 and n×m(inclusive).Also, you are given two values hand w, and your ...

2019-04-07 17:55:43 610

原创 B - Memory Management System

It is your first day in your new job and guesses what, your first task is already waiting for you! Your task is to build a memory management system.In this system, the memory will consist of mbyte...

2019-04-07 17:49:43 548

原创 C++输入快速流

void read(int &ans){ char c; ans = 0; while ((c = getchar()) < '0' || c > '9'); while (c >= '0'&&c <= '9') { ans = ans * 10 + (c - '0'); c = getchar(); }}#includ...

2019-04-06 18:26:30 534

原创 C. Queen

You are given a rooted tree with vertices numerated from11tonn. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.Ancestors of the vertexiiare all vertic...

2019-04-04 18:14:29 406

空空如也

空空如也

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

TA关注的人

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