当前位置:网站首页>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;
}
边栏推荐
- ANSYS command
- AWT常用组件、FileDialog文件选择框
- How much computing power does transformer have
- Basic concept of bus
- Nexus 6p downgraded from 8.0 to 6.0+root
- ES6 modularization
- [microservice] Nacos cluster building and loading file configuration
- 1.1 history of Statistics
- 报错cvc-complex-type.2.4.a: 发现了以元素 ‘base-extension‘ 开头的无效内容。应以 ‘{layoutlib}‘ 之一开头。
- Invalid revision: 3.18.1-g262b901-dirty
猜你喜欢

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

HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)

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

冲击继电器JC-7/11/DC110V
![[Excel] 数据透视图](/img/45/be87e4428a1d8ef66ef34a63d12fd4.png)
[Excel] 数据透视图

体验碎周报第 102 期(2022.7.4)

Learning multi-level structural information for small organ segmentation

Leakage detection relay jy82-2p

剑指 Offer II 038. 每日温度

Functions in C language (detailed explanation)
随机推荐
webrtc 快速搭建 视频通话 视频会议
Grounding relay dd-1/60
Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
Kubernets first meeting
left_ and_ right_ Net interpretable design
检漏继电器JY82-2P
Install pytoch geometric
Excel 比较日器
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
Programmers don't talk about morality, and use multithreading for Heisi's girlfriend
724. Find the central subscript of the array
Online shrimp music will be closed in January next year. Netizens call No
left_ and_ right_ Net normal version
[microservice] Nacos cluster building and loading file configuration
fastjson
win10清除快速访问-不留下痕迹
Tutle clock improved version
BUU-Reverse-easyre
Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
每周小结(*63):关于正能量