当前位置:网站首页>Fast power (template)
Fast power (template)
2022-07-04 06:02:00 【Zheng Qingda doesn't know his name】
Fast power ( Templates )
Time complexity O(logn);
Spatial complexity O(1);
double myPow(double x, int n) {
if(n==0) return 1;
double sum=1;
long long m=abs(n);//long long Type prevents n=-2^31 Take the timing and burst it int;
while(m) {
if(m&1) {
if(n>0) sum*=x;
else sum/=x;
}
m>>=1;
x*=x;
}
return sum;
}
边栏推荐
- [Excel] 数据透视图
- Layoutmanager layout manager: flowlayout, borderlayout, GridLayout, gridbaglayout, CardLayout, BoxLayout
- Component、Container容器常用API详解:Frame、Panel、ScrollPane
- BUU-Crypto-[GXYCTF2019]CheckIn
- Design and implementation of tcp/ip series overview
- Arc135 a (time complexity analysis)
- Tutle clock improved version
- Excel comparator
- Configure cross compilation tool chain and environment variables
- HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
猜你喜欢

How to get the parent node of all nodes in El tree

QT 获取随机颜色值设置label背景色 代码

实用的小工具指令

AWT introduction

Webrtc quickly set up video call and video conference

AWT介绍
![[Excel] 数据透视图](/img/45/be87e4428a1d8ef66ef34a63d12fd4.png)
[Excel] 数据透视图

webrtc 快速搭建 视频通话 视频会议

How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?

HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
随机推荐
2022.7.3-----leetcode.556
Webrtc quickly set up video call and video conference
Win10 clear quick access - leave no trace
Grounding relay dd-1/60
BUU-Pwn-test_ your_ nc
Kubernets first meeting
Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
How to avoid JVM memory leakage?
Detectron: train your own data set -- convert your own data format to coco format
Practical gadget instructions
AWT introduction
Uninstall Google drive hard drive - you must exit the program to uninstall
tutle时钟改进版
How to expand all collapse panels
JS execution mechanism
Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
How to choose the middle-aged crisis of the testing post? Stick to it or find another way out? See below
Gridview出现滚动条,组件冲突,如何解决
High performance parallel programming and optimization | lesson 02 homework at home
Luogu deep foundation part 1 Introduction to language Chapter 5 array and data batch storage