自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Coldfresh的博客

keeeeeep!~

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

原创 Maze HDU - 5094(BFS)

This story happened on the background of Star Trek. Spock, the deputy captain of Starship Enterprise, fell into Klingon’s trick and was held as prisoner on their mother planet Qo’noS. The captain ...

2018-07-16 21:24:46 224

原创 Battle ships HDU - 5093(二分图最大匹配)

Dear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently. Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographi...

2018-07-16 20:18:26 223

原创 Seam Carving HDU - 5092(简单dp)

Fish likes to take photo with his friends. Several days ago, he found that some pictures of him were damaged. The trouble is that there are some seams across the pictures. So he tried to repair these ...

2018-07-16 19:18:27 362

原创 线段树的合并

题目描述: 现在有一棵二叉树,所有非叶子节点都有两个孩子。在每个叶子节点上有一个权值(有n个叶子节点,满足这些权值为1..n的一个排列)。可以任意交换每个非叶子节点的左右孩子。 要求进行一系列交换,使得最终所有叶子节点的权值按照遍历序写出来,逆序对个数最少。 input: 第一行n 下面每行,一个数x 如果x==0,表示这个节点非叶子节点,递归地向下读入其左孩子和右孩子的信息, 如果...

2018-07-15 20:58:42 367

原创 Minimum Inversion Number HDU - 1394(权值线段树)

The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, …, an, if we move the firs...

2018-07-15 19:35:01 256

原创 Xor Sum HDU - 4825(01字典树)

Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向人类求助。你能证明人类...

2018-07-15 15:30:04 147

原创 Law of Commutation HDU - 6189(推导)

As we all know, operation ”+” complies with the commutative law. That is, if we arbitrarily select two integers a and b, a+b always equals to b+a. However, as for exponentiation, such law may be wrong...

2018-07-14 20:37:08 272

原创 关于17/18年蓝桥省赛决赛的一些印象

今日得闲,可以回忆回忆了。不知道从何说起,这是我第二次参加蓝桥了,第一次是去年第8界的时候,那个时候学算法学了3个月了,因为我是从2017年1月14号开始学习,为什么这么精确,因为那天是放寒假的时候,刚坐飞机回到家,我发了一条微博,说这是我正式开始的时候。记得寒假是按照HDU的acm课件学习的,这个真是个好东西,所以其实那个我学了好多东西,但是其实都是杂而 不精。那个时候实在太弱了。对什么...

2018-06-12 00:14:09 761

原创 二分图最大匹配

来自裸题:过山车 HDU - 2063 代码:import java.util.Arrays;import java.util.Scanner;public class Main{ final static int maxn=1005; final static int maxx=2005; final static int INF =0x3f3f3...

2018-05-24 21:04:35 207

原创 最大流(dinic算法)

题目来源Drainage Ditches HDU - 1532 ,裸的最大流 代码: 选用dinic有如下优势 1.代码量小,容易记忆。 2.效率上比EK算法快很多,虽然比asp稍慢,但是是可以接受的。import java.util.Arrays;import java.util.Scanner;public class Main{ final static...

2018-05-24 21:03:37 1272

原创 无向图的边双连通分量(FROM Redundant Paths POJ - 3177 )

In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Apples....

2018-05-17 19:51:23 334

原创 无向图的桥

没有具体例图,就是直接找出,那些边是桥。import java.util.Arrays;import java.util.Scanner;public class Main{ static int SIZE=100010; static int head[]=new int[SIZE],to[]=new int[SIZE<<1],next[]=ne...

2018-05-17 19:07:51 1260

原创 有向图的强连通分量

HDU - 2767(强连通分量) 求一个有向图里加最少的边使得任意两点可达。。import java.util.ArrayList;import java.util.Arrays;import java.util.LinkedList;import java.util.Queue;import java.util.Scanner;public class Main{ ...

2018-05-17 19:04:51 498

原创 倍增LCA

There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How far is it if I want to go from house A to house B”? Usually it hard to...

2018-05-15 19:33:07 366

原创 直径 HYSBZ - 3124(树的直径)

小Q最近学习了一些图论知识。根据课本,有如下定义。树:无回路且连通的无向图,每条边都有正整数的权值来表示其长度。如果一棵树有N个节点,可以证明其有且仅有N-1 条边。 路径:一棵树上,任意两个节点之间最多有一条简单路径。我们用 dis(a,b) 表示点a和点b的路径上各边长度之和。称dis(a,b)为a、b两个节点间的距离。 直径:一棵树上,最长的路径为树的直径。树的直径可能不是唯一的。 ...

2018-05-15 18:02:34 306

原创 「Poetize9」升降梯上(tyvj2032)(最短路)

开启了升降梯的动力之后,探险队员们进入了升降梯运行的那条竖直的隧道,映入眼帘的是一条直通塔顶的轨道、一辆停在轨道底部的电梯、和电梯内一杆控制电梯升降的巨大手柄。 Nescafe之塔一共有N层,升降梯在每层都有一个停靠点。手柄有M个控制槽,第i个控制槽旁边标着一个数Ci,满足C1<C2<C3<……<CMC1<C2<C3<……<CMC_

2018-05-14 19:44:52 1070

原创 Sudoku POJ - 3074(DFS)

Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The othe...

2018-05-10 21:14:30 342

原创 Booksort POJ - 3460 (IDA*)

The Leiden University Library has millions of books. When a student wants to borrow a certain book, he usually submits an online loan form. If the book is available, then the next day the student can ...

2018-05-10 16:43:48 315

原创 Nightmare Ⅱ HDU - 3085(双向BFS)

Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maze. They will kill the p...

2018-05-09 15:22:09 309

原创 Java输入输出流相关

读取控制台输入: 这种是从控制台读入字节流的一般写法;BufferedReaderr br=new BufferedReader(new InputStreamReader(System.in));从控制台读取多字符输入: 然后我们从br对象用read(),写法如下: (每次调用 read() 方法,它从输入流读取一个字符并把该字符作为整数值返回。 当流结束的时候返回 -1。该方...

2018-05-07 19:17:21 140

原创 18年ACM山东省赛随想

昨天正式赛打完了,有遗憾也有惊喜。至少圆了我的省赛的心愿。真的的是爆人品了,前一天热身赛打得太好了。直接到了rank5。当时的B题只是想验证一下想法,没想到直接过了,也让我心里很不安。后来疯狂waA,想弥补一下…坐在后面的是山大的大一队伍,热身赛刚结束了,就过来问我B题的解法,然后解答了一番。。。山大的学生果然不一般,即使是热身赛。从这里就可以看出,应该可以在未来的区域赛再次看到他们。但...

2018-05-07 12:41:31 459

原创 Editor HDU - 4699 (模拟)

Input 8 I 2 I -1 I 1 Q 3 L D R Q 2 Output 2 3思路:就是模拟了,关键是怎么模拟了,这里用两个栈,如果左移就做边出栈,然后压到右边的栈。通过两个栈来模拟光标左右移动,其也就差不多了。 代码:#include<iostream>#include<cstdio>#include<sta...

2018-05-03 14:11:38 276

原创 Coconuts HDU - 5925(二维离散化

TanBig, a friend of Mr. Frog, likes eating very much, so he always has dreams about eating. One day, TanBig dreams of a field of coconuts, and the field looks like a large chessboard which has R rows ...

2018-05-02 14:16:34 509

原创 Auxiliary Set HDU - 5927(思维题)

Given a rooted tree with n vertices, some of the vertices are important. An auxiliary set is a set containing vertices satisfying at least one of the two conditions: ∙It is an important vertex ∙...

2018-04-30 15:43:55 271

原创 BUY LOW, BUY LOWER POJ - 1952(LIS)(dp)

The advice to “buy low” is half the formula to success in the bovine stock market.To be considered a great investor you must also follow this problems’ advice: “Buy low; buy lowe...

2018-04-29 16:24:37 159

原创 What day is that day? ZOJ - 3785 (数学)(二项式)(等比数列求和)

It’s Saturday today, what day is it after 11+22+33+...+NN11+22+33+...+NN1^1 + 2^2 + 3^3 + ... + N^N days?Input There are multiple test cases. The first line of input contains an integer T indicatin...

2018-04-26 16:04:48 333

原创 The Accomodation of Students HDU - 2444(二分匹配判断+最大匹配)

There are a group of students. Some of them may know each other, while others don’t. For example, A and B know each other, B and C know each other. But this may not imply that A and C know each other....

2018-04-26 14:58:20 314

原创 Problem Arrangement ZOJ - 3777 (状压dp)

The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange the order of the problems. As we know, the arrangement will have a great effect o...

2018-04-25 18:43:44 206

原创 GCD Expectation ZOJ - 3868 (容斥)

Edward has a set of n integers {a1, a2,…,an}. He randomly picks a nonempty subset {x1, x2,…,xm} (each nonempty subset has equal probability to be picked), and would like to know the expectation of [gc...

2018-04-25 17:23:17 223

原创 Batch Scheduling POJ - 1180(斜率dp)

There is a sequence of N jobs to be processed on one machine. The jobs are numbered from 1 to N, so that the sequence is 1,2,…, N. The sequence of jobs must be partitioned into one or more batches, wh...

2018-04-22 17:35:15 257

原创 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-04-16 17:45:32 278

原创 Cleaning Shifts POJ - 3171 (线段树优化dp)

Farmer John’s cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer John, the most obliging of farmers, has no choice but hire so...

2018-04-15 22:05:42 300

原创 Sub-Bipartite Graph FZU - 2141 (贪心)

Given a simple undirected graph G with n vertices and m edges, your task is to select a sub-bipartite graph of G with at least m/2 edges.In the mathematical field of graph theory, a bipartite graph ...

2018-04-14 20:34:24 272

原创 Cleaning Shifts POJ - 2376(贪心)

Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day i...

2018-04-13 23:00:10 272

原创 Digits Count FZU - 2105 (线段树)

Given N integers A={A[0],A[1],…,A[N-1]}. Here we have some operations:Operation 1: AND opn L RHere opn, L and R are integers.For L≤i≤R, we do A[i]=A[i] AND opn (here “AND” is bitwise operation)....

2018-04-13 20:07:20 273

原创 Super A^B mod C FZU - 1759 (欧拉降幂)

Given A,B,C, You should quickly calculate the result ofABmodCABmodC A^B mod C. (1<=A,C<=1000000000,1<=B<=101000000).(1<=A,C<=1000000000,1<=B<=101000000).(1

2018-04-12 16:44:21 362

原创 Machine Schedule POJ - 1325 (二分匹配)

As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that...

2018-04-11 11:26:58 226

原创 Intervals POJ - 1201(差分约束)(最短路)

You are given n closed, integer intervals [ai, bi] and n integers c1, …, cn. Write a program that: reads the number of intervals, their end points and integers c1, …, cn from the standard input, ...

2018-04-10 17:03:11 280

原创 Deleting Edges HDU - 6026 (最短路)

Little Q is crazy about graph theory, and now he creates a game about graphs and trees. There is a bi-directional graph with n nodes, labeled from 0 to n−1. Every edge has its length, which is a pos...

2018-04-07 21:27:47 213

原创 原根概念及相关问题

在正题之前,我们需要群论的相关知识,实际上对某个数取模构成的集合就是一个群。群是一个特殊的集合,所以首先它是一个集合,其次,在集合之上构成群的条件就是,集合里面的元素之间存在一个二元运算,会生成其他在集合里的任意元素。 设SSS为一个群,⊕⊕\oplus为一个二元运算。 则严格定义: 封闭性:∀a,b∈S,a⊕b∈S∀a,b∈S,a⊕b∈S{\forall}a,b\in S,a\oplu...

2018-04-07 12:36:27 814 1

空空如也

空空如也

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

TA关注的人

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