当前位置:网站首页>Sword finger offer16- integer power bit operation of numeric value
Sword finger offer16- integer power bit operation of numeric value
2022-07-18 04:43:00 【Li Fan, hurry up】
Note:
You can put n Integration 2 Let's see , If the current one is 1, Explain that you want to take this one , No 1 Just skip.
It's the template. Remember, it's over
The code is as follows :
class Solution {
public:
double myPow(double x, int n) {
bool flag = false;
double ans = 1.0;
if(n < 0) flag = true;
long long k = abs((long long) n);
while(k){
if(k & 1) ans *= x;
x *= x;
k >>= 1;
}
if(flag) return 1 / ans;
return ans;
}
};
边栏推荐
猜你喜欢
随机推荐
同花顺周末能开户吗 开户安全吗
1143.最长公共子序列
OneNote代码高亮
EN 1158建筑五金件门协调装置—CE认证
剑指Offer17-打印从1到最大的n位数-模拟
Cookie与Session
LeNet
Mutual conversion between tensor and img
为什么阿里巴巴规定禁止超过三张表 join?
WPS关闭烦人广告
Une nouvelle méthode de test d'interface utilisateur: test de perception visuelle
【福利活动】给你的代码叠个 Buff!点击“茶”收好礼
Luogu p4113 [heoi2012] flower picking solution
Generate XML file of VOC dataset
LeetCode_动态规划_中等_718.最长重复子数组
C语言基础知识(自用)
红外超分调研
【rasterio】geojson矢量栅格化
Notes tree traversal
Machine learning exercise 5 - bias and variance

![[SQL injection] Stack Injection](/img/aa/6ad848479d492170fdd5d7613cbe64.png)






