3
27
2010
1

数论模板

 

ll mul_mod(ll x, ll y, ll n){
	// V x -> ( x = a T + b, 0 <= a <= T, 0 <= b < T ) 
	x %= n;
	y %= n;
	ll T = floor( sqrt(n) + 0.5 );

	// |t| < T
	ll t = T * T - n;

	ll a = x / T; ll b = x % T;
	ll c = y / T; ll d = y % T;
	ll e = a * c / T; ll f = a * c % T;
	
	ll v = ( ( a * d + b * c ) % n + e * t ) % n;
	ll g = v/T; ll h = v % T;
	ll ans =(( (f+g) * t % n + b * d ) % n + h * T ) % n;
	while(ans<0)ans+=n;
	return ans;
}


ll pow_mod(ll a, ll n, ll p){
	ll d = a % p;
	ll ans = 1;
	for(; n; n>>=1){
		if(n&1) ans = mul_mod( ans, d, p );
		p = mul_mod( d, d, p );
	}
	return ans;
}

 

 

Category: 未分类 | Tags: | Read Count: 1121
Avatar_small
boardmodelpaper.com 说:
2024年1月24日 18:01

The Board model paper" typically refers to a sample or model question paper that is designed by educational boards or institutions for various exams. These papers serve as practice material for students preparing for exams, providing them with an idea of the question format, difficulty level, and the type of content that may be covered in the actual examination. boardmodelpaper.com Model papers are usually created for specific subjects or courses. They cover a range of topics and chapters that students are expected to have studied during the academic term. Students often use these educational board model papers as an integral part of their exam preparation strategy, helping them familiarize themselves with the exam pattern and refine their understanding of the subject matter.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com