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

Tomcat how to view Tomcat version and number

  tomcat How to view Tomcat version and number CreationTime–2018August 31st, 10:16 Author:Marydon 1.tomcatExhibition   2.Specific operation   Implementation: run the version.bat file of Tomcat under the CMD command. Step one: open the CMD window.   win+r–>cmd–>Enter The second step: return to the root directory of C disk.   Input command: CD \ –> carriage return. The third step: switch to the disk (tomca disk).   Input command: d: –> carriage return. The fourth step: switch to OmcA’s bin directory.   Input command: CD apac...

ARDUINO UNO digital pin port is unstable after power up.

ARDUINO UNOThe digital pin port is unstable after power on. in use4*4When the matrix keyboard is encountered, the input level can not be stable and has been recognized as high level. After discovering this problem, first check whether the program is wrong. After checking, there was no problem with the program. So check the voltage value of the port during the period, this is a more intuitive method, you can clearly know the level of the output port. The result is that the voltage figure is only a few points below zero when the button is not pressed, which obviously belongs to low level. When ...

Mysql_select single table query

select *         *Representing all   Query multiple fields select  Field 1, field 2, field 3   Polymerization function  count(*)       Statistics select count(*)                 sum() Summing up select sum() Or select sum (CJ)                 avg() average value select avg() Or select AVG (CJ)                 max() Maximum value select max() Or select max (CJ)                 min() minimum value select min() Or select min (CJ), min (CJ). Examples: #For the 001 students, the highest score, the lowest score, the total sc...