1. Create a new name for an existing type.
typedef existing_type new_type_name ;
#include <iostream> #include <algorithm> #include<string> using namespace std; typedef int ai; int main() { int a=9; ai x2=71; cout<<x2<<endl; return 0; }
2. Pointer
int p; // this is a common integer variable
int * p; // beginning with P, first with *, and the description is a pointer P, and then combined with the int, the contents described pointer points to the int type is the P type a return pointer integer data.
int P [. 3]; // beginning with P, first with [], indicating that P is an array, then combined with the int, described in the array elements are integer, the P is an array of data consisting of integer
int * p [3]; // beginning with P, first with [], because of its higher priority than *, it is a P array, and then combined with the *, array elements are described pointer type, then combined with the int, described pointer points to the type of content is an integer, and the P is an integer returned by the data pointer consisting of array
int (* p) [3] ; // beginning with P, with the first binding *, P is described and then a pointer] combined with [(and "()" can ignore this step, just to change the priority ), indicating that the content is a pointer points to the array, and then combined with the int, the array elements are described integer. Therefore, P is a pointer to an integer number of Consisting of an array of pointers
int ** p; // P starts from the first, first with *, said P is a pointer, then combined with the * described pointer points to a pointer element is then combined with the int, Description the pointer points to integer data elements is due to two pointer pointer and higher rarely used in complex type, so the back of a more complex type of multi-stage we do not consider the pointer, a maximum of only considers pointer.
int P (int); // from P, first with (), indicating that P is a function, then into () in the analysis, indicating that the function has parameters of an integer variable, and then with the outside int binding, indicating a return value of the function is integer data
Int (* p) (int) ; // start from P, first with the pointer, a pointer P described and then combined with (), described is a function pointer, and then combined with () in the int described function has a parameter of type int, recombined with the outermost int described function return type is an int, so P is a pointer to an integer argument and return type of the function pointer integer
int * (* p (int)) [ 3]; // you can skip, this type do not look too complicated from P starts, first with (), indicating that P is a function, then into () which, combined with the int , there is described a function of an integer variable parameter, and then combined with the outside * described function returns a pointer to the outermost layer, and then, first with [], the description returns a pointer to an array, * then combined with the described elements in the array pointer is then combined with the int, content description pointer is integer data, so P is a parameter to an integer data and returns a pointer to a pointer to an integer variable composition function pointer variable array.
3.KMP algorithm
Somehow looked a long time, this says very good, but the specific code or read a bit
https://blog.csdn.net/qq_40938077/article/details/80460853
4. Some thoughts on the ACM
https://blog.csdn.net/qq_40688707/article/details/80602064
The double base palindrome
Determining whether a number is a palindromic sequence at least two binary, modulo constant, and dividing the obtained binary conversion method
#include <stdio.h> #include < String .h> #define MAX_SIZE 100 + 10 int operator ( int m, int n) / * will be converted to the n m-ary number * / { IF (m == 0 ) / * for any binary, 0 is 0, it must be a palindrome * / return . 1 ; int array_X [MAX_SIZE]; int I, J, L; for (I = 0 ; m> 0 ; I ++) / * find ary n-ary way is to continuously remainder, after the reverse output * / { array_X [I] = m%n-; m / = n-; } L = i; / * L i is the binary conversion after a few number of * / / * where the number can be detected after the binary conversion for (i = L-1; i> = 0; i--) the printf ( "% D", array_X [I]); the printf ( "\ n-"); * / for (I = 0 , = L-J . 1 ; I <J; ++ I, J,) / * stored in the array in reverse order, this is not to be detected of a palindrome * / IF (array_X [I] =! array_X [J]) return 0 ; / * if not, then a return value palindromic 0 * / return . 1 ; } int main () { int m,i,sum; while(scanf("%d",&m)!=EOF) { for(sum=0,i=2;i<=10&&sum<2;i++) { sum+=operator(m,i); } if(sum==2) printf("Yes\n"); else printf("No\n"); } return 0; }