Java program foundation

Basic structure //Single line notes /*Multiline comment/ /*Special multiline comment*/ /** * Comments that can be used to automatically create documents */ public class Hello { public static void main(String[] args){ // Output text to screen: System.out.println("Hello, Sam!"); ...

Posted by geoffism on Wed, 29 Jan 2020 02:18:40 -0800

Python code learning -- functions and built-in functions

python code learning -- functions and built-in functions function Syntax of functions Parameters of function Parameter / position parameter Default parameters Use of return dynamic parameter Key parameters Mixed use of function parameters Exercises Function calls to each other Local variable, glo ...

Posted by jonathandg on Tue, 28 Jan 2020 20:10:50 -0800

Python thread synchronization lock, semaphore

Synchronization lock import time, threading def addNum(): global num num -= 1 num = 100 thread_list = [] for i in range(100): t = threading.Thread(target=addNum) t.start() thread_list.append(t) for t in thread_list: t.join() print('final num:', num) //Run result: final num: 0 import time, threading def addNum(): ...

Posted by slevytam on Tue, 28 Jan 2020 08:18:59 -0800

5th Exercise in C++ Primer Chapter 5 Sentences 1~10

Exercise 5.1 What is an empty sentence?When do you use empty statements? An empty statement is a statement that does nothing. You can use an empty statement when you need one syntactically but logically. Exercise 5.2 What is a block?When will blocks be used? Blocks are curly bracketed statements and seq ...

Posted by bhinkel on Mon, 27 Jan 2020 23:23:46 -0800

JavaScript syntax: error handling mechanism

1. Error Instance Object When JavaScript parses or runs, the engine throws an error object whenever an error occurs.JavaScript natively provides the Error constructor, and all errors thrown are examples of this constructor. var err = new Error('Error'); console.log(err.message); // "Error" ...

Posted by seavolvox on Mon, 27 Jan 2020 21:58:28 -0800

Vue learning notes calculation properties VS listener VS method

For any complex logic, you should use computational properties, the official website says. computed: Directly use the name of the calculated property as the variable name. Calculated properties are cached based on their dependencies. A computed property is re evaluated only if its associated dependency changes. That is, w ...

Posted by Ironmann00 on Mon, 27 Jan 2020 08:59:36 -0800

1001 A+B Format && 1002 A+B for Polynomials

1001 A+B Format Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Specification: Each input file contains one test case. Each case contains a pair of integers a and b where −10 ​6 ​​ ...

Posted by dacio on Mon, 27 Jan 2020 06:43:40 -0800

Linked list accelerator -- Talking about skip list and its application in Redis

Background of problem As we all know, for the search of elements in an ordered set, if the set is stored through an array, then the binary search algorithm can quickly find elements by using the efficiency of array random access. So suppose that if the collection is stored through a linked list, can i ...

Posted by pages on Sun, 26 Jan 2020 21:39:31 -0800

Python crawler: crawling Bilibili video (. m4s)

This article is for reference only:Bili Bili video capture The video capture of station b is still relatively difficult. Compared with the video capture of other websites, it is also relatively difficult because of my curiosity and fear of death. I intend to analyze and analyze the video of station b. t ...

Posted by prcollin on Sun, 26 Jan 2020 03:43:16 -0800

Computer problems in the second round examination of Huazhong University of science and technology

Title Link: https://www.nowcoder.com/ta/hust-kaoyan?page=1 1. Matrix transpose Title Description Input a matrix of N*N, transpose it and output. Requirement: do not use any array (local inversion). #include <iostream> #include <vector> #include <math.h> #include<stdlib.h> using ...

Posted by roadkillguy on Sun, 26 Jan 2020 03:22:48 -0800