感觉自己的码风还是比较独特的,特此记录一下 ——2020.4.4
在代码中提前插入这一段,偷懒时必要时可视情况#define int LL
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<bitset>
#include<set>
#include<map>
#define LL long long
#define rg register
#define us unsigned
#define eps 1e-6
#define INF 0x3f3f3f3f
#define ls tr[k].l
#define rs tr[k].r
#define tmid ((tr[k].l+tr[k].r)>>1)
#define nmid ((l+r)>>1)
#define Thispoint tr[k].l==tr[k].r
#define pushup tr[k].wei=tr[ls].wei+tr[rs].wei
#define pub push_back
#define lth length
using namespace std;
inline void Read(int &x){
int f=1;
char c=getchar();
x=0;
while(c<‘0‘||c>‘9‘){
if(c==‘-‘)f=-1;
c=getchar();
}
while(c>=‘0‘&&c<=‘9‘){
x=(x<<3)+(x<<1)+c-‘0‘;
c=getchar();
}
x*=f;
}
一般会在下面加一句#define N 数据范围
,其中N
可改为M
等其他名称,但一定要为单个大写字母
数据范围视情况而定,一般是题中最大数据+10
接下来是定义区,题目中用到的大部分变量都将在此定义为全局变量
紧接着是结构体区,题目中所用到的结构体将在此定义,格式为:
struct 结构体名 {
结构体内变量
}数组名;
与之配套的一些变量(如链式前向星的head、cnt等)
与之相关的函数或重载符号,如链式前向星的ade、排序用的cmp等
再往下是函数区,用于定义题中用到的所有函数
main函数一定要在最下方
整篇代码不能有多于一行的空行,且空行一般加在函数定义之间以便区分
原文:https://www.cnblogs.com/juruoajh/p/12632444.html