Object oriented 3

Group exercises, call other members initiatively   Combinatorial exercises The first question:    1 class StarkConfig(object): 2 def __init__(self,num): 3 self.num = num 4 5 def changelist(self,request): 6 print(self.num,request) 7 8 class RoleConfig(StarkConfig): 9 def changelist(self,request): 10 print(666,self.num) 11 12 #A list is created, with three instances of objects in the list. 13 [StarkConfigObject (num=1), StarkConfig object (num=2), RoleConfig object (num=3))] 14 config_obj_list = [StarkConfig(1),StarkConfig(2),RoleConfig(3)]...

2017 ACM-ICPC EC-Final ShangHai (thinking chaos competition)

Feeling is all about thinking.     Gym – 101775J Straight Master To give you n poker, you can produce 3 to 5 sheets each time and ask if you can finish it.   Sample Input 2 13 1 2 2 1 0 0 0 0 0 0 0 0 0 13 1 1 1 1 0 1 1 0 0 0 0 0 0 Sample Output Case #1: Yes Case #2: No   It is equivalent to reducing the total length of a 3~5 interval by 1 to 0. Obviously, it is also possible to reduce an interval that is longer than 5 by 1 at a time, because 6 = 3 + 3, 7 = 3 + 4… So the problem becomes an interval with a length greater than or equal to 3 each time. The difference...

Chapter6.1, file system operation and context management

File operation IOThe operation is generally referred to as file IO. If it refers to network IO, it will directly talk about network IO. cp936 = codepage936It’s GBK, the way Microsoft codes.China’s information technology is relatively late, the earliest Chinese coding is Big5 code, and then unified use of GB2312, now the general is GBK code,Using two-bit byte encoding, encoding range 0-65535, retaining the ASCII code 0-127, Chinese characters use two bytes, by looking up the encoding table, to determine the meaning of a string of bytes. You can see the meaning of 0 and 1 on disk ...

What are the common myths about block chains?

  What are the common myths about block chains?   Blockchain technology can be used not only for encrypting money, but also for identifying people, recording food resumes and other applications. But each new technology has a hype and reality level, and to de-centralize the ideal block chain, what are the common myths?   1、There is only one block chain.   When people see block chains in the media, they think there is only one block chain in the world. In fact, block chains are plural and not singular. Each block chain has different functional purposes. The block chain can be...

7 method of obtaining file suffix in PHP

In our daily work, we can not avoid to often get the file suffix name, today I have collated seven ways to get the file suffix, I hope to help you. $url = 'http://www.baidu.com/uploads/20185425.jpg'; get_ext1($url); function get_ext1($url=''){ $url = parse_url($url); $name = strrchr($url['path'],'.'); p(strtolower(substr($name,1))); } get_ext2($url); function get_ext2($url=''){ $num = strrpos($url,'.'); $name = substr($url,$num+1); p(strtolower($name)); } get_ext3($url); function get_ext3($url=''){ $url = explode('/',$url); $file = $url[count($url)-1]; ...

Java foundation multithread 2[thread control]

Multi thread 2[thread control] 1.Thread scheduling and setting thread priority (1).Two models of thread scheduling A:In the time-sharing scheduling model, all threads take turns to use CPU usage and allocate the time slice of each thread occupying CPU. B:The preemptive scheduling model gives priority to the use of CPU by high priority threads. If the priority is the same, then at this time a randomly selected CPU is obtained by high priority threads. The time slice is relatively small. javaThe preemptive scheduling model is used. (2).thread priority A:Get priority of thread public f...

Java foundation multithread 1[thread introduction and first multithreaded program]

Multithreading 1.Introduction of multithreading If there is only one way to execute the program, the program is a single threaded program. If there are multiple ways to execute, then changing the program is multithreading. 2.Process overview and multi process significance If you want to know the thread, you must understand the process first, because the thread is dependent on the process. (1).What is a process? It’s the running application. It is an independent unit for resource allocation and scheduling. Each process has its own memory space and system resources. (2).What i...