Day5: application of const static, a special member, and this explicit, a friend
const:
① Data member: must be initialized with an initialization member list.
wbm(string name,const int age):name(name),age(age){}
② Constant member function: 1.const is at the end
2. You cannot use this as an interface to modify data me ...
Added by corillo181 on Sun, 05 Dec 2021 22:33:57 +0200
Tree and binary tree
1. Pre order printing node
[problem description] the algorithm is designed to print the leaf nodes of the binary tree in the way of preorder traversal.
[input form] a line of string, which is the preorder traversal sequence of the extended binary tree, which is used to construct the binary tree.
[output form] the pre order leaf traversal s ...
Added by jaz529 on Sun, 05 Dec 2021 07:52:03 +0200
Re: binomial inversion from zero
Favorite formula:
Formula 1:
\(\large f(n) = \displaystyle\sum^n_{k=0}\dbinom{n}{k}g(k) \\ \large \Rightarrow g(n) = \displaystyle\sum^n_{k=0}\left(-1\right)^{n - k}\dbinom{n}{k}f(k)\)
Formula 2 (at most and exactly):
\(\large f(n) = \displaystyle\sum^n_{k=m}\dbinom{n}{k}g(k) \\ \large \Rightarrow g(n) = \displaystyle\sum^n_{k=m}\left(-1 ...
Added by zulubanshee on Sun, 05 Dec 2021 06:58:59 +0200
The underlying implementation of Vector container
Vector
Vector is also one of the six components of STL. In short, it is a sequential container that encapsulates dynamic size arrays. At the same time, it can store various objects, such as int, char, string types and so on Because it is essentially a sequential container, it is stored in a sequential manner, similar to an array, and it ca ...
Added by salomo on Sun, 05 Dec 2021 05:55:28 +0200
Learn from me the application of c + + intermediate tools -- the event of gtest
1, gtest events
The event mechanism of gtest is actually another form of unit testing. It has two basic meanings: 1. It can process relevant data before and after specifying conditions and scenes 2. It can provide notification of results before and after specified conditions and scenarios The events in gtest are divided into three basic levels ...
Added by brad_langdon on Sun, 05 Dec 2021 05:36:12 +0200
Cattle guest school recruitment true question 1
Given ${N} $vertices, you can form a tree from these ${N} $vertices. If the tree has exactly three forks, we call this tree ${Y} $tree.
Now, given ${N} $vertices, please find out how many ${Y} $trees can be built from these ${N} $vertices? ###Input format:
The first line of input gives the number of vertices ${N} $.
${4 \le N \le 10^{18}} ...
Added by acctman on Sun, 05 Dec 2021 04:50:47 +0200
[CMake] Writing collation of CMakeList
What is CMake
If the software is to be cross-platform, it must be able to be compiled on different platforms. If you use the Make tool, you have to write a Makefile once for each standard. CMake is a tool designed to address these issues: it first allows developers to write a platform-independent MakeList.txt file to customize the entire compi ...
Added by miro on Sat, 04 Dec 2021 19:23:37 +0200
Educational Codeforces Round 118 (Rated for Div. 2)
1,A. Long Comparison-Educational Codeforces Round 118 (Rated for Div. 2)
Meaning: give x1,y1,x2,y2. X1 and X2 represent the cardinality, y1 and y2 represent the power of multiplying by 10 (for example, x1=29,y1=3, the number is 29000). It is required to judge whether X1 times 10 is greater to the y1 power or x2 times 10 is greater to t ...
Added by kishore_marti on Sat, 04 Dec 2021 08:18:20 +0200
c + + start from scratch - function overloading
1. Concept of function overloading
Using function overloading to create functions enables users to use multiple functions with the same name. They do different jobs and use different parameter lists, but the function names are the same. Overloaded functions are like verbs with multiple meanings. The key to overloading a function is the paramet ...
Added by maest on Sat, 04 Dec 2021 06:53:55 +0200
c + + student information processing
Problem Description Every student in a school has to learn three public courses: Chinese, English and mathematics. Students majoring in accounting should study accounting and economics Two professional courses. Students majoring in chemistry should study two professional courses: Organic Chemistry and chemical analysis. (1) Write the ComFinal b ...
Added by snidog on Fri, 03 Dec 2021 13:22:16 +0200