go求abc=a^3+b^3+c^3
package main
import "fmt"
func isOk(n int) bool {
tmp := n
a := tmp % 10
tmp /= 10
b := tmp % 10
tmp /= 10
c := tmp
if a * a * a + b * b * b + c * c * c == n {
return true
}
return false
}
func main() {
for val := 100; val <= 999; val++ {
if isOk(val) {
fmt.Println(val)
}
}
}
写入自己的博客中才能记得长久