Map (go) related operations and matters needing attention

So far, we have talked about the collection of high-level data types belonging to containers for single elements. They either store elements in succession or store them as interdependent pointers, each representing an independent value that belongs to a particular type.   The dictionary we’re going to talk about today is different. It stores not a collection of single values, but a collection of key-value pairs.   What is the key value pair? It is a word literally translated from English key-value pair. As the name implies, a key pair represents a pair of keys and values.   Note that...

Spring simple explanation (two) IOC singleton, inheritance, dependency, JDBC, factory mode and automatic loading.

IOCSingleton mode –Bean SpringThe bean in China is determined by scope. scopeThere are 4 types: 1.singleton:The singleton model indicates that the object obtained through the Spring container is unique.Commonly used and defaults. 2.prototype:Multiple-instance model, which means that objects retrieved through the Spring container are different (similar to the unique object address of new in Java infrastructure). 3.reqeust:The request indicates that it is valid in a HTTP request. 4.session:Session, which is valid in a user session.   1.Create an object public class User { p...

#28. canal — the nineteenth test of Yucai OJ

Problem description In the city of N, the location of n city is just the vertex, just forming a positive n shape. In order to promote the development of trade, it is necessary to open several canals (the number of canals can be 0) between certain cities. The canals must be opened in a straight line, starting and ending in two different cities.It means that the two canals cannot intersect (the two canals share a city as the starting and ending point), otherwise, there will be war between the cities because of the cost of water used in the canal. The number of schemes for opening the canal. Inp...

GodFly’s Treasure Hunt: DP

A brief description of the topic, a little cumbersome, this GodFly’s treasure hunt. Explanation: because there are only 18, DP is used. First read the edge. R[i][j] represents the number of edges between I and J. Define the state: f [i] [s] [w] means to stay at point i, the path set i s s, and the total cost i s w. The answer i s Sigma (f [n] [s] [q]), where s i s an arbitrary state. Initialization: f[1][1][0]=1; State transition equation: from I point, state s to t point, then there is f[t][s|(1<<t-1)][(0+t×num[s])%2]+=f[i][s][0]×r[i][t] f[t][s|(1<<t-1)][(1+t×num[s])%2]+...

Python learning experience (1): word frequency statistics, top-down design

Today’s program is a Hamlet word frequency statistics, that is, statistics of the frequency of each word in Hamlet. For the first time, I tried to use the top-down design method and the top-down execution method. A lot of errors have been recorded during this period, so as to avoid future recidivism. Before programming, intercept one part of Hamlet online.It should be noted that when the txt type is saved, the encoding mode selects’utf-8′. Figure: Next, analyze the whole programming topic and list the steps: The first step is to open the file and read it and separate every ...

Let your Spring Boot application run quickly on Docker.

  Precondition: 1. Docker is already installed on the server (my side is CentOS 7) (the installation steps are simple, refer to my last blog) 2.Java and Maven have been installed on the server.   After meeting the above conditions, we can begin: 1. Create a simple Spring Boot application with only one controller, DockerController, as follows: package cn.bounter.docker.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestM...