跳到正文

个人记录

【Back Up】旧版主页2 20250808

Limit_Yank_Peak约 13 分钟
原文
文章信息与版本

文章信息

发布
2025年8月8日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 13 分钟

版本

  1. v5当前
  2. v4
  3. v3
  4. v2
更早的 1 个版本
  1. v1

公告

本人的大号\large\color{blue}本人的大号 本人的学术号\large\color{red}本人的学术号

有事请在此聊天室联系我(非24小时必回)

VL工作室\color{red}\large VL 工作室 PFROI官方团队\color{blue}\large PFR OI 官方团队

请收下本蒟蒻的一膜吧\Huge\color{red}请收下本蒟蒻的一膜吧{}

如何收下膜拜(请收下我的膜拜)\large\color{blue}如何收下膜拜(请收下我的膜拜) 自研发电脑炸弹\large\color{red}自研发电脑炸弹

本\Large\color{yellow}本 蒟蒻\Large\color{red}蒟蒻 菜\Large\color{blue}菜 特别菜\Large\color{green}特别菜 非常菜。\Large\color{red}非常菜\color{black}。 但依然有他的\large\color{yellow}但依然\color{green}有他的 大事祭\Large\color{red}大事祭

不会有人发现这个还能点进去吧

膜拜的两位巨佬

alt text alt text

友链

alt text alt text alt text alt text

个人常用头文件

g++ 指令:

代码
-Wall -O2 -std=c++20 -Wl,--stack=2147483648
C++
#include<bits/stdc++.h>
#define int long long
//#define lson (x<<1)
//#define rson ((x<<1) | 1)
//#define mid ((l+r)>>1)

//#define putchar putchar_unlocked
//#define getchar getchar_unlocked
#define rep(K,F,T) for(int K = F;K <= T;K++)
#define rip(K,F,T) for(int K = F;K >= T;K--)

using namespace std;
namespace florr{
	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;
	}
	void write(int x)
	{
		if (x < 0)
			putchar('-'), x = -x;
		if (x > 9)
			write(x / 10);
		putchar(x % 10 + '0');
		return;
	}
}
using namespace florr;
signed main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	
	return 0;
}
/*
*/

高精度板子

C++
#include<bits/stdc++.h>
#define int long long
//#define putchar putchar_unlocked
//#define getchar getchar_unlocked
#define rep(K,F,T) for(int K = F;K <= T;K++)
#define rip(K,F,T) for(int K = F;K >= T;K--)

using namespace std;
namespace florr{
	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;
	}
	void write(int x)
	{
		if (x < 0)
			putchar('-'), x = -x;
		if (x > 9)
			write(x / 10);
		putchar(x % 10 + '0');
		return;
	}
}
using namespace florr;

struct BigInt{
	static const int BASE = 100000000, DIG = 8;      // 1e8 进制,每块 8 位十进制
	vector<int> a;                                   // a[0] 是最低位,只存非负整数

	BigInt(){}
	BigInt(int x){ while(x > 0) a.push_back(x % BASE), x /= BASE; }

	bool zero() const { return a.empty(); }
	void trim(){ while(!a.empty() && a.back() == 0) a.pop_back(); return; }

	void read()                                      // 读入一个非负整数(忽略前导空白)
	{
		a.clear();
		char ch = getchar();
		while (ch < '0' || ch > '9')
			ch = getchar();
		static char buf[1000005];
		int len = 0;
		while (ch >= '0' && ch <= '9')
			buf[len ++] = ch, ch = getchar();
		rip(i, len - 1, 0){                          // 从低位往高位,每 8 位压成一块
			int l = max(0ll, i - DIG + 1), v = 0;
			rep(k, l, i) v = v * 10 + (buf[k] - '0');
			a.push_back(v);
			i = l;
		}
		trim();
		return;
	}
	void print()
	{
		if(a.empty()){
			putchar('0');
			return;
		}
		write(a.back());
		rip(i, (int)a.size() - 2, 0){                // 后面的块补足 8 位
			int v = a[i];
			char buf[DIG];
			rip(k, DIG - 1, 0) buf[k] = char('0' + v % 10), v /= 10;
			rep(k, 0, DIG - 1) putchar(buf[k]);
		}
		return;
	}

	friend int cmp(const BigInt &x,const BigInt &y)
	{
		if(x.a.size() != y.a.size())
			return x.a.size() < y.a.size() ? -1 : 1;
		rip(i, (int)x.a.size() - 1, 0)
			if(x.a[i] != y.a[i])
				return x.a[i] < y.a[i] ? -1 : 1;
		return 0;
	}
	friend bool operator< (const BigInt &x,const BigInt &y){ return cmp(x, y) <  0; }
	friend bool operator> (const BigInt &x,const BigInt &y){ return cmp(x, y) >  0; }
	friend bool operator<=(const BigInt &x,const BigInt &y){ return cmp(x, y) <= 0; }
	friend bool operator>=(const BigInt &x,const BigInt &y){ return cmp(x, y) >= 0; }
	friend bool operator==(const BigInt &x,const BigInt &y){ return cmp(x, y) == 0; }
	friend bool operator!=(const BigInt &x,const BigInt &y){ return cmp(x, y) != 0; }

	friend BigInt operator+ (const BigInt &x,const BigInt &y)
	{
		BigInt z;
		int carry = 0, len = max(x.a.size(), y.a.size());
		rep(i, 0, len - 1){
			int s = carry;
			if(i < (int)x.a.size()) s += x.a[i];
			if(i < (int)y.a.size()) s += y.a[i];
			z.a.push_back(s % BASE), carry = s / BASE;
		}
		if(carry) z.a.push_back(carry);
		return z;
	}
	friend BigInt operator- (const BigInt &x,const BigInt &y)   // 要求 x >= y
	{
		BigInt z = x;
		int borrow = 0;
		rep(i, 0, (int)z.a.size() - 1){
			z.a[i] -= borrow + (i < (int)y.a.size() ? y.a[i] : 0);
			if(z.a[i] < 0) z.a[i] += BASE, borrow = 1;
			else borrow = 0;
		}
		z.trim();
		return z;
	}
	friend BigInt operator* (const BigInt &x,const BigInt &y)
	{
		BigInt z;
		if(x.zero() or y.zero()) return z;
		z.a.assign(x.a.size() + y.a.size(), 0);
		rep(i, 0, (int)x.a.size() - 1){
			int carry = 0;
			rep(j, 0, (int)y.a.size() - 1){
				carry += z.a[i + j] + x.a[i] * y.a[j];
				z.a[i + j] = carry % BASE;
				carry /= BASE;
			}
			z.a[i + y.a.size()] += carry;
		}
		z.trim();
		return z;
	}
	BigInt& operator+= (const BigInt &y){ *this = *this + y; return *this; }
	BigInt& operator-= (const BigInt &y){ *this = *this - y; return *this; }
	BigInt& operator*= (const BigInt &y){ *this = *this * y; return *this; }
};
BigInt x, y, z;
signed main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	x.read(), y.read();
	z = x + y, z.print(), putchar('\n');
	z = x * y, z.print(), putchar('\n');
	if(x >= y) z = x - y, z.print(), putchar('\n');
	else putchar('-'), z = y - x, z.print(), putchar('\n');
	return 0;
}
原文