跳到正文

sandianshui

1059487

en

在洛谷打开
资料、奖项与版本

资料

编号
1059487
抓取

https://www.luogu.com.cn/paste/jal1le9u

题单

云剪贴板

图片上传

C++
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');
}
C++
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);
	}
}

看着有用,先收藏了

ด้้้้้็้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็็็็้้้้้็็็็็้้้้้้็็

博客

如何礼貌的下次一定

膜拜他

共 1 篇
  1. 个人记录

    A4纸背单词法

    本文指出背单词的最大障碍并非单词本身,而是因感觉未记住而产生的挫败感,其根源在于对记忆规律认知不足及复习时间过少。作者主张调整“记忆”与“复习”的时间比例,强调复习的重要性,并将其类比为熟悉同学名字的过程。具体方法建议使用 A4 纸进行默写训练:每记一个新词便默写并依次回顾此前所有单词,以强化长期记忆。最终目标是在暑假期间完成九年级单词的背诵。

    1 赞