个人码风介绍

个人码风介绍

//不向焦虑与抑郁投降,这个世界终会有我们存在的地方。
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cassert>
#include<tuple>
#include<ctime>
#include<random>
#if __cplusplus>=202002L
#include<ranges>
namespace vw=std::views;
#endif
#define siz(x) int((x).size())
#define cauto const auto
#define all(x) std::begin(x),std::end(x)
#define rall(x) std::rbegin(x),std::rend(x)
#define sqrt __builtin_sqrt
#define fi first
#define se second
#define continue(x) {x;continue;}
#define break(x) {x;break;}
using std::cin;using std::cout;
using std::max;using std::min;
using std::tie;using std::ignore;
template<typename any>inline void cmin(any &x,const any &y){if(y<x)x=y;}
template<typename any>inline void cmax(any &x,const any &y){if(x<y)x=y;}
template<typename any,typename...args>inline void cmax(any &x,const any &y,const args &...z){cmax(x,y);cmax(x,z...);}
template<typename any,typename...args>inline void cmin(any &x,const any &y,const args &...z){cmin(x,y);cmin(x,z...);}
using loli=long long;
using uloli=unsigned long long;
using lodb=long double;
using venti=__int128_t;
using pii=std::pair<int,int>;
using tiii=std::tuple<int,int,int>;
using inlsi=const std::initializer_list<int>&;
using bsi=std::basic_string<int>;
using bsc=std::string;
using std::operator""s;
#if __cplusplus>=201703L
using bscv=std::string_view;
using std::operator""sv;
#endif
struct _time{~_time(){std::cerr<<"\n\033[33;40m"<<1.*clock()/CLOCKS_PER_SEC<<"s\033[37;40m";}}_TM;
std::mt19937 rng(std::random_device{}());
constexpr venti operator""_vt(uloli x){return venti(x);}
constexpr bool ying=false,yang=true;
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	std::ios::sync_with_stdio(false);cin.tie(nullptr);
	return 0;
}
  1. 不采用万能头
  2. 采用 #if 去表示高版本有的库
  3. 所有
  4. 为了防止关于 STL size 上的 warning 采用强转
  5. 采用 all(x) fi se#define
  6. using namespace std; 而只 using 一些常用的
  7. 采用模板,不定长传参等
  8. 大量使用 STL,高版本使用 ranges
  9. ying=false yang=true
  10. 尽可能不写空格除了很丑的情况比如 return(a+b) case'1'
  11. 采用 tab,大括号不换行
  12. 尽可能少换行,采用逗号压起来
  13. 采用 vector 存边
  14. 采用 basic_string 代替没有构造函数的 vector
  15. 结构体避免命名
  16. 采用 constexpr 修饰常量
  17. 采用倍增代替二分
  18. 写继承
  19. 使用 cin cout
posted @ 2022-11-14 20:35  蒟酱  阅读(60)  评论(0编辑  收藏  举报