缺省源
Winter_LoL_ · · 个人记录
自用缺省源。
注释:
- 将
long long类型简写为int类型。若可能爆空间或时间,将此行注释。 - 将
unsigned long long类型简写为ull类型。 - 将
long double类型简写为ldb类型。 rep1(i,x,y)即定义变量i ,从表达式x 的值至表达式y 的值自小到大循环。(x \le y )rep2(i,x,y)即定义变量i ,从表达式x 的值至表达式y 的值自大到小循环。(x \ge y )max(x,y)即返回表达式x 的值与表达式y 的值中的较大值。min(x,y)即返回表达式x 的值与表达式y 的值中的较小值。writesp(x)即快速输出表达式x 的值并输出空格。writeln(x)即快速输出表达式x 的值并输出换行。sp即快速输出一个空格。ln即快速输出一个换行符。read()即返回一个快速读入的整型值(遇到非数字字符结束读入)。write(x)即快速输出表达式x 的值。仅能输出整形的值。putstr(s)即输出字符串s 。fre()线下模拟赛用,即开启文件输入输出。文件名需自己在函数内修改。- 取消注释主函数中的
// TimeKeeper=read();即可多测。
Code:
// Coded by @Winter_LoL_ ( Luogu uid : 1281338 )
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define ldb long double
#define rep1(i,x,y) for(register int i=(x);i<=(y);++i)
#define rep2(i,x,y) for(register int i=(x);i>=(y);--i)
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define writesp(x) write(x),putchar(' ')
#define writeln(x) write(x),putchar('\n')
#define sp putchar(' ')
#define ln putchar('\n')
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
#define base1 199999999937
#define base2 7399999991
#define mod 998244353
inline int read(){int x=0;bool p=0;char c=getchar();while(c<'0'||c>'9'){p=(c=='-'?1:p);c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}return p?~(x-1):x;}
inline void write(int x){if(x<0){putchar('-');x=~(x-1);}if(x>9)write(x/10);putchar(x%10|48);}
inline char getcha(){char c=getchar();while(c==' '||c=='\n')c=getchar();return c;}
inline void putstr(string s){for(int i=0;s[i]!='\0';i++)putchar(s[i]);}
inline void fre(){freopen(".in","r",stdin);freopen(".out","w",stdout);}
namespace Winter_LoL_{
signed main(int ID){
return 0;
}
}signed main(){
// fre();
int TimeKeeper=1;
// TimeKeeper=read();
rep1(Vertin,1,TimeKeeper)Winter_LoL_::main(Vertin);
return 0;
}
Update:
2024.11.25:
加入 max(x,y),min(x,y),sp,ln。\
删除 getstr(),putstr(s)。实测没有 cin,cout 快。
2024.11.26:
听取 @scguo 大佬的意见,加入return 0;。
2024.12.20:
为了码风统一,重新加入 putstr(s)。
2025 1~3 月:
在部分函数前加入 inline,省去不必要的入栈时间。
Update : 似乎没什么用。不管了。
2025.5.24:
将 read() 中的 getchar() 改为 getchar_unlocked()。
2025.5.31:
将 read() 中的 getchar_unlocked() 改回 getchar()。
2026.4.25:
加了一些奇怪的东西。例如:
mod,base1,base2以及别的一些宏定义;- 命名空间;
- 开头的奇怪注释;
- 并且现在能够更方便地多测了!(特别注意:多测不清空,爆零两行泪。不要以为封装在命名空间里就不用清空了)
2026.5.29
微调。使得实现多测更容易了(同时也更不容易忽略而导致保龄了)!