There are many places in the C language where macro definitions are used, such as in header files to prevent header files from being repeatedly included:
#ifndef ctest_header_h
#define CTEST_HEADER_H
/header file content
#endif
Many macro
Write the following two lines of code in the header file:
typedef int X;
typedef int X;
GCC compiler will immediately report redefinition of the TypeDef ' X ', change g++ incredibly nothing, weird it. So to check the document, found in C + + is
1. One-dimensional array for maximum sub-segments and; (hdu1003,hoj1760)
This is the most basic of the largest sub-segments and models: given a sequence a[0],a[1],a[2],... a[n], requiring a continuous paragraph, so that the sum of the largest. If
Use a single loop to initialize a multi-dimensional array
For programmers, the most commonly used multi-dimensional arrays are two-dimensional arrays and three-dimensional arrays. The method and essence of multi-dimensional arrays are similar. Here
Dijkstra and Floyd should pay attention to the heavy side.
Dijkstra
#define INF 0X3FFFFFFF
#define M-
int dist[m], map[m][m], N;
BOOL Mark[m];
void init ()
{
int i, J;
for (i = 1; I Floyd
#define INF 0X3FFFFFFF //note, too assembly
Define is a pre-processing command in C language. It is used for macro definition, which can improve the readability of the source code and provide convenience for programming.Pre-processing commands start with "#", for example, include commands #
2015.1.23I'm on duty today.Continue with yesterday Makefile's goal begins to record:The first kind: there is. Phnoy declaration, but no dependent file after colon. Phnoy:cleanclean://No dependent filesRM *.0 TempThe second type: the file before and
1 NO parameter macro definitionThe macro name of the parameterless macro is not followed by a parameter.The general form of its definition is:#define Identifier stringWhere the "#" indicates that this is a preprocessing command. All that begin with "
Ek complexity O (V * E)
# Define n 204 int C [N] [N]; // edge capacity int f [N] [N]; // actual edge traffic int pre [N]; // record the augmented path int res [N]; // residual network queue QQ; void Init () {While (! QQ. empty () QQ. pop ();
There are two types of macro definitions: macro definitions without parameters and macro definitions with parameters.
Macro definition without ParametersThe general format of macro definition without parameters is:
# Define macro name string# Define
Define is a pre-processing command in C language. It is used for macro definition, which can improve the readability of the source code and provide convenience for programming.
Pre-processing commands start with "#", for example, include commands #
When I went to college, I circulated such a super-good C program. I could use only three lines of code to calculate the number of π to 800 digits after the decimal point. I joked that it was written by aliens, it's really amazing. At that time,
NYoj-27-pool quantity-DFS-BFSPool quantity time limit: 3000 MS | memory limit: 65535 KB difficulty: 4
Description
There are some small rivers and some lakes on the campus of Nanyang Institute of Technology. Now we take them all as pools.
It's relatively simple .. Set template ..
Gabow
# Include "cstdlib" # include "cctype" # include "cstring" # include "cstdio" # include "cmath" # include "algorithm" # include "vector" # include "string" # include "iostream" # include "sstream" #
1, [CPP] view plain copy int A; #define M (x,y) (x/y) A = m (4+2, 3) a=?This is the knowledge of macro definitions, and the definition of macros is simply substitution.
The expansion of M (4+2, 3) is 4+2/3.
So a=4.
The following two examples may
1 OverviewUsed preprocessing commands starting. For example, include the command # include and macro definition command # define. In the source program, these commands are placed outside the function, and are generally placed before the source file.
I. What is an optimal binary tree?
In my personal understanding, the optimal binary tree is to form a tree through a combination of given destination weighted nodes (individual nodes. minimum tree weight. the optimal binary tree is a binary tree
Recursive Arrangement
The main idea of Recursive Backtracking in Arrangement
P (n, m) is equivalent to placing a piece on each row of an M * n board, and ensure that each column has only one piece.Each piece can be placed in N positions. Therefore,
Algorithm (algorithm): basic ideas, methods, and steps for solving computer problems. Algorithm Description: describes the methods and steps taken to solve a problem or to complete a task, including the required data (input data and output results)
Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess theorem Lucas calculates the big composite number,E. Gerald and Giant Chesstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
Giant chess is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.