[P2402] cow hiding

Binary answer + maximum flow. If the length of the answer is less than or equal to the answer, it can be connected with the edge. (the shortest circuit between pre-treatment points) Of course, we have to break it down. (otherwise, for this problem, there will be a situation that the traffic x-y does not walk on the shortest side of the x-y Road ...

Posted on Sat, 30 Nov 2019 20:37:51 -0500 by mchaggis

A general explanation of Java

Why use generics? 1. Solve the security problem of element storage. 2. Solve the problem of strong type conversion when obtaining data elements. Where to use generics? 1. Comparison between using generics in sets and not using generics import java.util.*; public class TestGenericParadigm { public static void main(St ...

Posted on Sat, 30 Nov 2019 20:11:24 -0500 by robot_nader

New features of Java 8 lambda expression

A functional interface is an interface that explicitly declares only one abstract method. To ensure that the number of methods is small, java8 provides a special annotation @ functional interface, so that when there is more or less than one abstract method declared in the interface, an error will be reported. As shown in the ...

Posted on Sat, 30 Nov 2019 18:52:35 -0500 by lando

PAT A1033 key questions

This problem is a relatively difficult problem in greedy algorithm. The key is that it is difficult to summarize the specific steps. Here, the steps given in the following examples are explained in detail: First, the gas stations are arranged in distance order;The example divides the selection of the next node within the reachable range into t ...

Posted on Sat, 30 Nov 2019 18:20:48 -0500 by refined

Convert from BitArray to Byte

I have an eight BitArray , I need a function to convert it to a byte. How do you do it? Specifically, I need a correct ConvertToByte function: BitArray bit = new BitArray(new bool[] { false, false, false, false, false, false, false, true }); //How to write ConvertToByte byte myByte = ConvertToByte(bit); var recoveredBit = new Bit ...

Posted on Sat, 30 Nov 2019 18:12:22 -0500 by zc1

Several sort implementations for data structure - Quick sort, Bubble sort, Insert sort directly, Select sort directly, Heap sort

1. Insert Sort Directly Select one value to be sorted at a time to insert into the existing sorting sequence; (4,2,6,5,1,8) For an example of incremental ordering: key=2; less than 4, 4 move right, 2 insert 4, 246518 key=6; position fixed, 246518 key=5; 6 moved backward, 5 inserted; 245618 .... Repeat the above steps unt ...

Posted on Sat, 30 Nov 2019 16:20:09 -0500 by motofzr1000

Friendly Date Ranges make date ranges more friendly

Convert common date formats such as YYYY-MM-DD to a more readable format. Easy to read format should use month name instead of month number and ordinal number instead of number to represent day (1st instead of 1) Remember not to display the information that can be inferred: if the difference between the end date and the start date in a date r ...

Posted on Sat, 30 Nov 2019 12:57:02 -0500 by graphic3

Using java to describe the algorithm of matrix inversion

Today, I am very happy to solve the problem that has been bothering me for several days, when I was studying linear algebra. If you want to realize the calculation method in the program, such as matrix inversion, how to describe it in java code? First of all, let's describe the algorithm in our language: 1. Find out the cofactor of the determ ...

Posted on Sat, 30 Nov 2019 12:41:37 -0500 by michaelpalmer7

Poj1637 sightseeing tour

Title Link meaning of the title In this paper, we give a mixed graph (with or without directed edges and directed edges) and ask if we can make the graph form an Euler loop by determining the direction of the undirected edges. thinking This is a template problem of mixed graph Euler circuit. In order to satisfy the Euler circuit, a graph must s ...

Posted on Sat, 30 Nov 2019 12:25:25 -0500 by ruddyu78

X264 application engineering

In the next few blogs, learn the implementation process of X264. The analysis of source code refers to Raytheon's blog, thank you Raytheon! Blog link: https://blog.csdn.net/leixiaohua1020/article/details/45536607.   1. overview The flow chart of X264 encoding is as follows:     ​ First, we need to create an encoder, initialize the encoder para ...

Posted on Sat, 30 Nov 2019 10:03:51 -0500 by EagerWolf