Step by step to achieve a complete go game
1, Draw a chessboard
It can be understood as simple character drawing skills: the first line, the middle line and the last line are different; For each row, the first column is different from the middle and last column.
There is a little skill in drawing star positions. Focus on understanding the meaning of this formula: ((I-4)% 6 = = 0 ...
Posted by sunil_23413 on Tue, 04 Jan 2022 07:01:17 +0100
C++_Primer_ Study notes_ Chapter 19 (special tools and technologies)
Chapter 19 (special tools and technologies)
/1. Control memory allocation
1). Standard memory management mechanisms cannot be applied directly.
Some applications need to customize the details of memory allocation, such as using the keyword new to place objects in a specific memory space.In order to achieve this goal, we need to overload the ...
Posted by wayz1229 on Tue, 04 Jan 2022 06:46:57 +0100
Binary tree pre, middle and post order traversal, iteration and Morris writing records
Binary tree pre, middle and post order traversal, iteration and Morris records
Preorder traversal of binary tree
iteration
class Solution {
public:
vector<int> preorderTraversal(TreeNode* root) {
vector<int> res;
if (!root) return res;
stack<TreeNode *> stk;
while (root || !stk.empty()) {
...
Posted by PHPnewby! on Tue, 04 Jan 2022 06:35:53 +0100
Data structure - heap
Heap
Heap is a special kind of data structure in computer science. Heap can usually be regarded as an array object of a complete binary tree.Heap classification: the heap with the largest root node is called the maximum heap or large top heap, and vice versa is called the minimum heap or small top heap. Common heaps include binary tree heaps, ...
Posted by Sorrow on Tue, 04 Jan 2022 04:10:43 +0100
[daily force deduction 15] effective letter words
1, Title [LeetCode-242]
Given two strings s and t, write a function to determine whether t is an alphabetic ectopic word of s.
Note: if each character in , s and t , occurs the same number of times, then , s and t , are called alphabetic words.
Example 1:
Input: s = "anagram", t = "nagaram"
Output: true
Exa ...
Posted by sebjlan on Tue, 04 Jan 2022 02:50:46 +0100
Informatics Olympiad all in one 2045: [example 5.13] snake number
[title link]
ybt 2045: [example 5.13] snake filling number
[title test site]
1. Two dimensional array
2. Direction array (may be used)
int dir[4][2] = {{1,0},{0,-1},{-1,0},{0,1}}; d is the current direction, 0: down, 1: left, 2: up, 3: right dir[d] is the change of the abscissa and ordinate after moving in the d direction, that is, the nex ...
Posted by lunarul on Tue, 04 Jan 2022 01:26:18 +0100
The interface between vector and list introduces how to use and distinguish, with code attached.
1, vector
Vector is a sequential container that encapsulates dynamic size arrays. It can store various types of objects. It can be considered that a vector is a dynamic array that can store any type.
Function implementation:
1. Constructor:
vector() parameterless construction vector (size_type n, const value_type & val = value_type() ...
Posted by knight on Tue, 04 Jan 2022 00:59:47 +0100
Luogu P1080 king game
Title Description
On the national day of HH, the king invited NN ministers to play a prize game. First, he asked each minister to write an integer on his left and right hands, and the king himself wrote an integer on his left and right hands. Then let the}nn ministers line up and the king stand at the front of the line. After lining up, all mi ...
Posted by iwarlord on Mon, 03 Jan 2022 22:50:00 +0100
Python advanced training - Num1, inheritance, polymorphism
Class: used to describe a collection of objects with the same properties and methods. It defines the properties and methods common to each object in the collection. An object is an instance of a class.Inheritance: that is, a derived class inherits the fields and methods of the base class. Inheritance also allows the object of a derived class to ...
Posted by marcusb on Mon, 03 Jan 2022 19:50:33 +0100
[C + +] Eigen introduction dense matrix 8 - Aliasing
reference resources: https://blog.csdn.net/whereismatrix/article/details/104569080
brief introduction
Aliasing means that in the assignment expression, an Eigen object (matrix, array, vector) appears in both lvalue and rvalue expressions, such as v = v*2; m = m.transpose();;
Alias confusion can cause errors and problems;
Here we will int ...
Posted by kb9yjg on Mon, 03 Jan 2022 19:21:39 +0100