当前位置:网站首页>Quick power explanation
Quick power explanation
2022-06-13 00:56:00 【-LM-】
Fast power
Time complexity O(logn)
(a + b) modp=(a modp + b modp) modp
(a - b) modp = (a modp - b modp + p) modp
a * b modp = a modp * b modp
const long long mod=1e9+7;
long long fastpow(long long x,long long y){
x%=mod;
long long res=1;
while(y){
if(y & 1) res=res*x%mod;
y>>=1;
x=x*x%mod;
}
return res;
}
边栏推荐
- The grass is bearing seeds
- 深度学习模型剪枝
- MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
- pytorch是什么?解释pytorch的基本概念
- People and gods are angry. Details of Tangshan "mass beating of women incident"
- [JS component] previous queue prompt
- Oceanbase is the leader in the magic quadrant of China's database in 2021
- 什么是 dummy change?
- Build your own PE manually from winpe of ADK
- What is pytorch? Explain the basic concepts of pytorch
猜你喜欢
随机推荐
MySQL异常:com.mysql.jdbc.PacketTooBigException: Packet for query is too large(4223215 > 4194304)
【服务器数据恢复】存储服务器之间迁移数据时数据丢失恢复成功案例
.net core 抛异常对性能影响的求证之路
深度学习每周期的步数多少合适?
Liu Hui and introduction to nine chapter arithmetic and island arithmetic
Common skills for quantitative investment - drawing 3: drawing the golden section line
Arduino uses esp8266+ lighting technology + Xiaoai audio to realize voice control switch
Common skills of quantitative investment - index part 2: detailed explanation of BOL (Bollinger line) index, its code implementation and drawing
Cards are unpredictable
sort
With a market value of more than trillion yuan and a sales volume of more than 100000 yuan for three consecutive months, will BYD become the strongest domestic brand?
Development notes of Mongoose
OceanBase 雄踞墨天轮2021年度中国数据库魔力象限领导者
Kotlin 协程挂起函数 suspend 关键字
Androi天气
Common skills for quantitative investment - indicators Chapter 3: detailed explanation of RSI indicators, their code implementation and drawing
Paper reading and sharing
[JS component] create a custom horizontal and vertical scroll bar following the steam style
Unity calls alertdialog
三角波与三角波卷积









![[JS component] simulation framework](/img/f2/8d5bb7e0db55a87ce76c09fae03694.jpg)