Use of classes (classes and objects, constructors and destructors)

Recent Studies on Classes and Objects I'm good at rowing. I didn't listen to classes. It's harmful, so it's a bit cloudy. So write this blog to understand.   The use of a class is like encapsulating something, defined as a class The place and structure defined are actually a little similar. It doesn't feel like much in the algorithm. Never touc ...

Added by Ting on Sun, 05 Apr 2020 22:59:27 +0300

BZOJ1087: [SCOI2005] mutual noninvasive King (DP)

Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 5168  Solved: 3006[Submit][Status][Discuss] Description Put K kings in the N × N chessboard so that they don't attack each other. How many kinds of placement schemes are there. The king can attack it up and down, left and right, and up and leftThere are 8 squares near each of the eight d ...

Added by olivarespablo on Sun, 05 Apr 2020 14:10:51 +0300

[TOJ 1214] data structure Exercise - linear table operation (vector Implementation)

Description Please define a linear table. You can insert an element before a location, delete the element in a location, clear all elements, and get the element in a location. You can do this by typing some commands on the keyboard. In this problem, the element of linear table is integer, and the first element position of linear table is 1. The ...

Added by drummerboy on Sat, 04 Apr 2020 08:16:21 +0300

Find the most frequent character in the string

/*Time limit C/C++ 3s other 6s, space limit C/C++ 32768k other 65535k Title Description Given a string of unlimited length, please find out the character with the most occurrence times in the string, and print out the character and its occurrence times;If the occurrence times of multiple characters are the same, only the first character will be ...

Added by ClevaTreva on Sat, 04 Apr 2020 03:34:10 +0300

18.C + + - [] operator use, function object and ordinary function difference (detailed explanation)

In the last chapter 17.C++-string string class (detailed) After learning the string class, we found that each character can be accessed through the [] overload operator. For example: string s="SAD"; for(int i=0,i< s.length();i++) cout<<s[i]<<endl;   Next, let's write a [] overload operator to simulate the string class ...

Added by Opv on Tue, 31 Mar 2020 21:14:11 +0300

Data structure -- non recursive implementation of tree traversal

Tree structure is an important nonlinear data structure. Tree is a finite set of n (n > = 0) nodes. In any non empty tree, there are and only When n > 1, the remaining nodes can be divided into m (M > 0) disjoint finite sets T1,T2,...,Tm, each of which The collection itself is a tree, and is called the root subtree. Therefore, the data ...

Added by gdure on Tue, 31 Mar 2020 12:28:34 +0300

Fast power of matrix

Background of topic Matrix fast power Title Description Given matrix A of n*n, find A^k I / O format Input format: First line, n,k Rows 2 to n+1, n numbers in each row, row i+1, and number j represent the elements in row i, column j of the matrix Output format: Output A^k There are n rows in total, N in each row. The number of rows i and j repr ...

Added by brash on Sat, 28 Mar 2020 18:42:26 +0200

Labyrinth Generation and Labyrinth Pathfinding in Labyrinth Algorithms

This paper describes the generation of labyrinths and labyrinth routing algorithms.     //////////////////////////////////////////////////////////////////////////////////////////////////// 1. Three Labyrinth Generation Algorithms 1. DFS (depth first) algorithm generation, which is divided into recursive and non-recursive methods. (2) Cross-sect ...

Added by 2005 on Wed, 25 Mar 2020 08:45:29 +0200

#Chapter 5: object oriented programming style

Basic knowledge The inheritance mechanism defines the parent-child relationship. The parent class defines the common public interface and private implementation for all children. Each subclass can add or override inherited things to achieve its own unique behavior. In C + +, the parent class is called base class, and the child class is called d ...

Added by davidz on Fri, 14 Feb 2020 10:56:33 +0200

Solution to the problem of permutation and counting of Logu P4071-[SDOI2016]

SDOI2016 permutation count It is found that many solutions fail to explain why the inverse element and recurrence formula are used in this problem. I, wind and rain 30 years, just to write a good problem. Let me help you. Main idea: A sequence whose length is n and 1~n occurs once respectively is expected to find out the number of sequences un ...

Added by jaql on Sun, 12 Jan 2020 15:34:52 +0200