Educational Codeforces Round 108 (Rated for Div. 2)A~D

Foreword: making A, B, D and C has been timeout, and I didn't think of how to optimize it. Rating: 1153 + 146 -- > 1299 (green) Don't talk about the problem, just talk about the solution and code. A. Red and Blue Beans   topic type: greed    analysis: if r is less than B, try to replace 1 with more, so calculate the differenc ...

Posted by integravtec on Sun, 20 Feb 2022 08:12:36 +0100

Enumeration, simulation and sorting

Example: consecutive interval number Xiao Ming has been thinking about such a strange and interesting question these days: How many consecutive intervals are there in an arrangement of 1 ∼ N? The definition of the serial interval here is: If all the elements in the interval [L,R] (i.e. the L-th to r-th elements of this arrangement) can ...

Posted by trrobnett on Sun, 20 Feb 2022 07:25:50 +0100

Summary of underlying data structure and class of camera HAL of Android Camera principle

There are many data structures in the camera HAL layer. When looking at the code, we often look for a long time to understand these data structures. In order to facilitate everyone's study, we specially summarize some data structures and their locations: 1.hardware/libhardware/include/hardware/camera_common.h: 1.1 camera_info_t : camera_info ...

Posted by jpopuk on Sun, 20 Feb 2022 05:36:02 +0100

Solution of the second computer test

T1: sequence query This question can be queried up to 10000 times. If recursion is used only, there will be multiple repeated calculations. Therefore, an array can be used to store the results calculated in the recursion process. When querying f(i), if f(i) has been calculated before, it can be output directly; If it has not been calculated, ...

Posted by apoc- on Sat, 19 Feb 2022 23:38:17 +0100

[hand tear STL] stack&queue

Introduction and use of stack stack is a container adapter, which is specially used in the context of last in first out operation. Its deletion can only insert and extract elements from one end of the container.Stack is implemented as a container adapter. A container adapter encapsulates a specific class as its underlying container, and pr ...

Posted by scotthoff on Sat, 19 Feb 2022 18:30:48 +0100

About concurrent HashMap from java7 to java8

Why use concurrenthashmap (the disadvantage of HashMap) HashMap is the most commonly used Map class in Java. It has good performance and fast speed, but it can not guarantee thread safety. It can use null value as Key/value The thread insecurity of HashMap is mainly reflected in the dead loop when resizing and fast fail when using iterator In ...

Posted by McJepp on Sat, 19 Feb 2022 17:22:12 +0100

Generate binary reflection code

Recursively generate binary reflection Code: Requirements: We use recursion to generate binary reflection gray code. What is gray code? The typical Binary Gray Code is abbreviated as gray code, which is named after the patent "Pulse Code Communication" of Frank Gray (18870913-19690523) published in 1953. It was originally used to ...

Posted by shazly on Sat, 19 Feb 2022 12:00:12 +0100

poj3565 (maximum weight perfect match)

Meaning: let n ants to an apple tree, and give the corresponding coordinates of N ants and N apple trees. To calculate the weight is to calculate the distance between coordinate points, and it is required to calculate the minimum distance! Idea: use the maximum weight perfect matching problem, but now the problem is to find the minimum weight. ...

Posted by zsedc on Sat, 19 Feb 2022 11:14:41 +0100

Topic + source code analysis (81 examples)

[Title 81] Title: a company uses a public telephone to transmit data. The data is a four digit integer and is encrypted in the transmission process. The encryption rules are as follows: add 5 to each number, then replace the number with the remainder of sum divided by 10, and then exchange the first and fourth bits, and the second and third bi ...

Posted by Pavel_Nedved on Sat, 19 Feb 2022 10:43:34 +0100

Introduction and creation of Huffman Tree

1. Basic introduction Huffman tree, alias "Huffman tree", "Huffman tree", "optimal tree" and "optimal binary tree" Given n weights as n leaf nodes, a binary tree is constructed. If the weighted path length (wpl) of the tree reaches the minimum, such a binary tree is called the optimal binary tree, also ...

Posted by Lautarox on Sat, 19 Feb 2022 10:31:56 +0100