Luogu P3243 [HNOI2015] cuisine making

Title gate This problem seems to know that it is a topological sort. In addition, it should be a legal solution to find the smallest dictionary order, so greedy to find the point with the smallest number with the current entry degree of 0. Congratulations, you fell into a hole. In fact, I did this at the beginning. Later, when I ...

Posted by jboku on Tue, 10 Dec 2019 17:08:06 -0800

Knapsack problem (Java implementation) - greedy algorithm

Knapsack problem greedy algorithm [problem description] n items and a backpack are given. The weight of item i is Wi, its value is Vi, and the capacity of backpack is c. How to choose the items in the backpack to maximize the total value of the items in the backpack [problem analysis] ·General knapsack problem! Optim ...

Posted by tomwerner on Tue, 10 Dec 2019 12:30:37 -0800

Write a UML plug-in to automatically generate code to free cv's hands

Introduction Recently, I am writing a middle stage project, which uses the UML framework of react. All kinds of additions, deletions, modifications and searches. It's basically a list page, a new page, a detail page In order to avoid unnecessary simple repetition (mainly to be lazy), I want to implement my own code generator explore First of al ...

Posted by fitzsic on Tue, 10 Dec 2019 10:23:56 -0800

Python crawler battle one: crawling to get Encyclopedia of embarrassing stories

  Now the regular expression is explained here 1). *? Is a fixed collocation. And * represent that any infinite number of characters can be matched, plus "*"? It means to use non greedy pattern to match, that is, we will match as short as possible, and we will use a lot of. *? Matching in the future. 2) (. *?) represents a group. ...

Posted by dcace on Tue, 10 Dec 2019 10:24:00 -0800

R and money game: golden cross 2

from Last article The analysis has learned that the golden cross rule of the mean line does not apply to the concussion period, so what is the way to avoid the concussion period or what is the way to reduce the loss of no brain following? Let's keep playing. Required Packages library(quantmod) library(ggplot2) library(scales) Postpone Trading ...

Posted by Bunyip on Tue, 10 Dec 2019 07:18:02 -0800

Talk about rocketmq's latency fault tolerance

order This paper mainly studies the latency fault tolerance of rocketmq LatencyFaultTolerance rocketmq-client-4.6.0-sources.jar!/org/apache/rocketmq/client/latency/LatencyFaultTolerance.java public interface LatencyFaultTolerance<T> { void updateFaultItem(final T name, final long currentLatency, final long notAvailableDuration); ...

Posted by kcgame on Tue, 10 Dec 2019 00:16:04 -0800

Redis source reading notes - server startup and initialization

Start of server The main function of Redis server is in server.c. // server.c int main(int argc, char **argv) { struct timeval tv; int j; /* Set some constants of the server */ /* We need to initialize our libraries, and the server configuration. */ #ifdef INIT_SETPROCTITLE_REPLACEMENT spt_init(argc, argv); #endif setl ...

Posted by jeff_papciak on Tue, 10 Dec 2019 00:11:57 -0800

Recursive function & binary search

I. recursive function 1) definition Calling function itself in function is recursion. The maximum depth of recursion in python is 1000, but the actual depth is less than 1000 def func(): print("-----func-----") func() func() 2) application You can use recursion to traverse various tree structures, such as folder system: you can us ...

Posted by Gruessle on Mon, 09 Dec 2019 20:01:37 -0800

Python practice example

43. Imitate another case of static variable. Program analysis: demonstrates a python scope usage method. #python3.7 class Num: nNum = 1 def inc(self): self.nNum += 1 print('nNum = %d' % self.nNum) if __name__ == '__main__': nNum = 2 inst = Num() for i in range(3): nNum += 1 print('The num = ...

Posted by Pascal P. on Mon, 09 Dec 2019 15:59:09 -0800

Realization of path path playback function based on Leaflet

Design sketch: Explain: 1. This function is based on this blog: Path path playback with ArcGIS JS API But there are some small problems: first of all, the car does not move at a constant speed, but the running time of each section is fixed, so it has been modified on this blog; on the other hand, there is no way to set the ...

Posted by xsist10 on Mon, 09 Dec 2019 13:15:25 -0800