package main
import "fmt"
func lowbit(x uint) uint {
return x & -x
}
func getOnes(x uint) uint {
var cnt uint
for x != 0 {
x -= lowbit(x)
cnt++
}
return cnt
}
func main() {
n, num := 0, uint(0)
fmt.Scanf("%d", &n)
for i := 0; i < n; i++ {
fmt.Scanf("%d", &num)
if i != 0 {
fmt.Print(" ")
}
fmt.Print(getOnes(num))
}
}
兄弟你没有填邀请码可以填一个,都可以得AC币!嘿嘿,谢谢兄弟
我的邀请码是:GUDFH