赞
踩
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; a <<= 1; b >>= 1; flag = ((b & 1) > 0) && (ans += a) > 0; return ans >> 1; }
}
---
### c
int sumNums(int n){
// 2的14次正好超过10000
// 等差数列求和公式n * (n + 1) / 2
int ans = 0, a = n, b = n + 1;
(b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); return ans >> 1;
}
---
### c++
class Solution {
public:
int sumNums(int n) {
// 2的14次正好超过10000
// 等差数列求和公式n * (n + 1) / 2
int ans = 0, a = n, b = n + 1;
(b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); a <<= 1; b >>= 1; (b & 1) && (ans += a); return ans >> 1; }
};
---
### python
class Solution:
def sumNums(self, n: int) -> int:
# 2的14次正好超过10000
# 等差数列求和公式n * (n + 1) / 2
ans = 0
a = n
b = n + 1
(b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) a <<= 1 b >>= 1 (b & 1) and (ans := ans + a) return ans >> 1
---
### go
func sumNums(n int) int {
// 2的14次正好超过10000
// 等差数列求和公式n * (n + 1) / 2
ans, a, b := 0, n, n + 1
addGreatZero := func() bool {
ans += a
return ans > 0
}
\_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() a <<= 1 b >>= 1 \_ = ((b & 1) > 0) && addGreatZero() return ans >> 1
}
--- ### rust ![img](https://img-blog.csdnimg.cn/img_convert/066a527707e5ee0ab9d75eb7ee3811c3.png) ![img](https://img-blog.csdnimg.cn/img_convert/d9e0cba55a71acb7206153ac9744dd8a.png) ![img](https://img-blog.csdnimg.cn/img_convert/e3a4321a19eb8d42c02035300f0741d3.png) **既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!** **由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新** **[如果你需要这些资料,可以戳这里获取](https://bbs.csdn.net/topics/618658159)**
[外链图片转存中…(img-2NTezSwg-1715484856276)]
[外链图片转存中…(img-AsHG4FRA-1715484856276)]
[外链图片转存中…(img-Gb24AuZ1-1715484856276)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Go语言开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。