https://www.luogu.com.cn/paste/jal1le9u
题单
云剪贴板
图片上传
char buf[1 << 20], * _now = buf, * _end = buf;
inline char _getchar()
{
return _now == _end && (_end = (_now = buf) + fread(buf, 1, 1 << 20, stdin), _now == _end) ? EOF : *_now++;
}
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch>'9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
x = x * 10 + ch - '0', ch = getchar();
return x * f;
}
inline void write(int x) {
static int sta[35];
int top=0;
do
{
sta[top++]=x%10, x/=10;
} while(x);
while(top) putchar(sta[--top]+'0');
}
inline double readdou() { //inline内联函数进一步优化速度
double x = 0; int flag = 0;//x是返回值,flag表示正负
char ch = 0; //初始化为空格
while (!isdigit(ch)) { //当输入不是数字时,一直读入但不记录到x中(建议直接使用isdigit判断)
flag |= (ch == '-');
ch = getchar();
}
while (isdigit(ch)) { //当输入的是数字时,一直记录到x中
x = x * 10 + (ch - '0'); //double不能用位运算了
ch = getchar();
}
if (ch != '.') return flag ? -x : x; //如果后面跟的不是小数点,则直接结束
int f = 1; //f用于设置某数字所对应的值
ch = getchar();
while (isdigit(ch)) {
x = x + (ch - '0') * pow(10, -f); //pow!
f++; //乘10^-1表示小数点后的第一位的值,10^-2表示小数点后的第二位的值...
ch = getchar();
}
return flag ? -x : x;
}
inline void write(int x) {
char num[30]; //存放翻转后的数字,方便输出
int cnt = 0; //num数组的大小
if (x == 0) { putchar('0'); return; }
if (x < 0) {
putchar('-');
x = -x;
}
while (x > 0) { //将数字分解成字符
num[cnt++] = x % 10 + '0';
x /= 10;
}
while (cnt > 0) {
putchar(num[--cnt]);
}
}
inline void writedou(double x) {
write(int(x)); //先输出x的整数部分
//减去x的整数部分
if (x < 0) x = -x;
x -= int(x);
if (x!=0) putchar('.');
while (x) { //循环输出小数部分
x *= 10;
putchar(int(x) + '0');
x -= int(x);
}
}
看着有用,先收藏了
ด้้้้้็้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็