1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
// @Title: 平方数之和 (Sum of Square Numbers)
// @Author: 15816537946@163.com
// @Date: 2020-06-25 07:15:36
// @Runtime: 0 ms
// @Memory: 1.9 MB
func judgeSquareSum(c int) bool {
	a, b := 0,int(math.Sqrt(float64(c)))
	for a<=b {
		if a*a+b*b == c  {
			return true
		} else if a*a+b*b < c {
			a++
		} else {
			b--
		}
	}

	return false
    
}