[read Primer] 13. User defined data structure Page64
In C + +, all types of data combinations are custom data structures.
Including string, istream, ostream and so on that we often use.
A simple type definition that starts with struct.
//Sales_data.h#include <string>struct Sales_data
{
std::string bookNo;
unsigned units_sold = 0; // According to the C++ 11 standard, the data member ...
Added by TechXpert on Mon, 06 Jan 2020 20:32:08 +0200
Hdu4405 aeroplane chess (expected dp)
meaning of the title
Copied from https://www.cnblogs.com/Paul-Guderian/p/7624039.html
Playing flying chess. Input n,m means that the flying chess has n squares and m flying points, then input m to u,v means that u point can fly directly to v point, i.e. u is the flying point. If the grid is not a flight point, throw dice (1-6 equal probabil ...
Added by salomo on Mon, 06 Jan 2020 17:10:38 +0200
[C + + learning notes] chain forward star
Chained forward star is a common way to store graph (it is the optimized version of forward star saving graph method). It supports adding edge and querying, but it does not support deleting edge (if you want to delete the specified edge, it is suggested to use adjacency matrix).
Storage mode
First, define the array head [i] to store the subsc ...
Added by arsitek on Sun, 05 Jan 2020 04:26:50 +0200
c/c + + right value reference, forward keyword
c++ forward keyword
The origin of forward: when the derivation type in template function is used as the parameter of function, that is to say, T & & arg is used to declare. After the specific type is derived, the specific type after derivation cannot be converted into right value reference. Forward is to solve this problem.
The forward( ...
Added by bamse on Sat, 04 Jan 2020 12:08:01 +0200
Hdu4035 maze (expected DP)
meaning of the title
Copied from https://www.cnblogs.com/Paul-Guderian/p/7624039.html
There are n rooms connected by n-1 tunnels to form a tree. Starting from node 1, start walking. There are three possibilities (the sum of probabilities is 1) at each node i: 1. Be killed and return to node 1 (the probability is ki); 2. Find the exit and wa ...
Added by krellen on Thu, 02 Jan 2020 04:23:44 +0200
Luogu P3959 treasure (simulated annealing)
meaning of the title
Title Link
It's a long topic... See for yourself..
Sol
I thought of an annealing idea. I didn't expect to pay 85 for the first time. I gave it back several times. Ha ha ha
First remove the useless edges, and then sort the remaining edges from small to large
In this way, we get a sequence of edge selection. We ask the ...
Added by WickedStylis on Wed, 01 Jan 2020 23:09:15 +0200
c/c + + arrays and pointers
c/c + + arrays and pointers
Knowledge points
1. Array is a pointer, corresponding to test1 in the code
2. Declare with auto to get a pointer, corresponding to test2 in the code
3. Declare with decltype. The result is not a pointer, corresponding to test3 in the code
4. Use the pointer to simulate end, corresponding to test4 in the code
5. Stand ...
Added by phpflixnewbie on Wed, 01 Jan 2020 13:41:09 +0200
Detailed explanation of c/c + + standard library insertion iterator
Detailed explanation of standard library insertion iterator
Insert iterator function: functions such as copy can't change the size of the container, so sometimes the container is empty before copy. If you don't use insert iterator, you can't use functions such as copy.
For example, the following code is wrong:
list<int> lst{1,2,3,4};
...
Added by bschmitt78 on Sat, 28 Dec 2019 19:08:37 +0200
Data structure & heap & priority & queue & Implementation
Catalog
What is a heap?
Big root pile
Heap
Heap operation
STL queue
What is a heap?
Heap is a data structure that can be used to implement priority queues
Big root pile
Big root heap, as the name implies, is the largest root node. First, we use the process of building small root heap to learn the idea of heap.
Heap
The following figure sho ...
Added by mattkenefick on Sat, 28 Dec 2019 19:04:23 +0200
Solve the problem that QTableWidget does not display data
QTableWidget is usually used for data display. Through its table layout, users can see the data more clearly and filter the data more intuitively.
However, beginners and careless people will always find that their data has been added normally, but after the program runs, they can not see any data on the QTableWidget, a blank.
What's going on? L ...
Added by Jax2 on Sat, 28 Dec 2019 16:48:51 +0200