Minimum coverage
Main idea: first determine an M, then input the coordinates of the left and right ends of multiple groups of line segments, and then let you find out that in the given line segment, you can
The minimum number of lines needed to completely cover the [0, M] area, and output the left and right endpoint coordinates of these lines.
Thought ...
Posted by Angus on Fri, 01 Nov 2019 04:13:04 -0700
python global replacement program
Exercise 1 - global replacement procedure:
1. Write a script to allow the user to perform global replacement of the specified file content as follows python your_script.py old_str new_str filename2. After the replacement, print how many parts have been replaced
1. Contents of TXT:
Ma Xianyu Shenzhen 173 13744234523
Qiao Yifei Guangzho ...
Posted by axnoran on Fri, 01 Nov 2019 02:55:12 -0700
UVA - 11996 jewel magic (tap + binary hash)
There are four operations to maintain a 01 sequence:
1. Insert a number
2. Delete a number
3. Reverse an interval
4. Query LCP with two suffixes
It can be done with Splay or Treap. Maintain hash value and binary LCP.
Note that the hash value of the sequence will also change when reversing the sequence, so it is necessary to maintain the p ...
Posted by guanche on Fri, 01 Nov 2019 01:10:06 -0700
P1433 [eating cheese]
This problem is a famous NP problem.
The positive solution should be DP, but I'm going to talk about an approximate algorithm here - climbing.
It is hoped that some dalao will pay attention to the difference between mountain climbing and simulated annealing.
Climbing is straight to the low to the high, each time take big, that is, a greedy thou ...
Posted by artist-ink on Thu, 31 Oct 2019 22:37:44 -0700
Nginx build notes
Because the application is in the internal network environment, it can not directly access the external network. However, the requirement is that the application needs to redirect to the external network environment's login QR code for code scanning and login. When processing page redirection, ...
Posted by erme on Thu, 31 Oct 2019 22:20:57 -0700
Dubbo and SSM integration (authentication and authorization) steps
1. Import the web project, create the authentication module, and modify the pom.xml file
2. Paste the profiles file into the authentication module. There are two files database.properties and redis.properties in the profiles folder.
Modify the database connection properties (user name, password, database name, etc.) in database.properties, an ...
Posted by idweb on Thu, 31 Oct 2019 20:07:50 -0700
Mutual conversion of Date and LocalDateTime in Java8
I. converting Date to LocalDateTime in Java 8
Method 1:
To convert Date to LocalDatetime, we can use the following methods:
1. Get zonedatetime from date and use its method toLocalDateTime() to get LocalDateTime
2. Use the Instant() factory method of LocalDateTime
Example:
package ins ...
Posted by dm404 on Thu, 31 Oct 2019 18:08:00 -0700
[STL] set operation
In STL, there are algorithms to realize intersection, union, difference and symmetric difference.
Include header file before use:
#include <algorithm>
Note: the algorithm of calculating intersection and union must ensure that the two sets involved in the operation are in order!
Intersection:
For example, find the intersection of ...
Posted by NickTyson on Thu, 31 Oct 2019 17:57:15 -0700
UA pool and IP proxy pool use
UA pool: user agent pool
-Function: disguise the requests in the project as different types of browser identity as much as possible.
-Operation process:
1. Intercept requests in download Middleware
2. Disguise the UA in the intercepted request header information
3. Enable download Middleware in configuration file
Code display
#Guide b ...
Posted by zymosan on Thu, 31 Oct 2019 17:45:30 -0700
sklearn linear regression
#
import numpy as np
import pandas as pd
from pandas import Series,DataFrame
import matplotlib.pyplot as plt
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['FangSong'] # Specify default font
mpl.rcParams['axes.unicode_minus'] = False # Resolve save image is negative'-'Questions displayed as squares
//Import data coastal ...
Posted by rowantrimmer on Thu, 31 Oct 2019 16:14:23 -0700