跳到正文

zzchenjunxuan

1681315

这是 2026年11月8日 存档的第 3 版,不是当前版本。查看当前版本

资料、奖项与版本

资料

编号
1681315
抓取

奖项

2025 CSP-J
二等奖
2025 CSP-S
二等奖
2024 CSP-J
二等奖

版本

  1. v4当前
  2. v3
  3. v2
  4. v1
C++
扩展欧几里得定理:exgcd(a,p,x,y),a^-1=(x%p+p)%p
exgcd(a,b,&x,&y)
	if b==0 
		x=1,y=0;
		return ;
	exgcd(b,a%b,x,y);
	int t=x;
	x=y;
	y=t-a/b*y;
费马小定理:a^-1=qpow(a,p-2)

前提:gcd(a,p)=1且p是质数

线性求逆元:inv_i=(p+floor(p/i))*inv_{p%i}%p

线性求f_i=f_{i+1} * (i+1) %p->f_i表示(i!)^-1

O(1)求逆元:i^-1=(i!)^-1 * (i-1)!

https://www.luogu.ac.cn/problem/list

代码
112.16.216.176:29860
http://nflsoi.cc:20035/
代码
https://acm.hdu.edu.cn/contests/contest_list.php

team0058
115399

team0059
404861

求关!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

C++
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
//    freopen(".in","r",stdin);
//    freopen(".out","w",stdout);

	return 0;
}
/*
*/
C++
namespace IO
{
	constexpr int fsize = 1<<24;
	#define getchar() ((IO::si!=IO::ti||(IO::ti=(IO::si=IO::input)+fread(IO::input,1,IO::fsize,stdin))),IO::si!=IO::ti?*(IO::si++):EOF)
	#define putchar(c) ((IO::out.so!=IO::out.to||(fwrite(IO::out.output,1,IO::fsize,stdout),IO::out.so=IO::out.output)),*(IO::out.so++)=c)
	char input[fsize],*si = input,*ti = input;
	struct output_stream
	{
		char output[fsize],*so = output,*to = output + fsize;
		inline ~output_stream()
		{
			if(so == output) return;
			fwrite(output,1,so-output,stdout);
			so = output;
		}
	}out;
	template<typename T>inline void read(T &x)
	{
		int c = getchar(),p = 1;
		x = 0;
		while(c < 48||c > 57)
		{
			if(c == 45) p = -1;
			c = getchar();
		}
		while(48 <= c&&c <= 57)
		{
			x = (x<<3)+(x<<1)+(c^48);
			c = getchar();
		}
		x *= p;
	}
	template<typename T>inline void write(T x)
	{
		static int c[40],cnt = 0;
		if(x < 0) putchar(45),x = -x;
		if(!x) putchar(48);
		while(x) c[++cnt] = x%10^48,x /= 10;
		while(cnt) putchar(c[cnt--]);
	}
}
using IO::read;
using IO::write;
代码
298649991203052898
5428931384572793919
3299995981154426290