633.sum-of-square-numbers.go 168 B

123456789
  1. func judgeSquareSum(c int) bool {
  2. for a := 0; a*a <= c; a++ {
  3. b2 := c - a*a
  4. if b := int(math.Sqrt(float64(b2))); b*b == b2 {
  5. return true
  6. }
  7. }
  8. return false
  9. }