def Wanquan(num):
    """num是正整数"""
    return bfs(num)


def bfs(num):
    """对num,求出其减去开方最大值后的剩余值"""
    i = 1
    result=0
    while True:
        if i * i > num:
            num = num - (i - 1) ** 2
            result += 1
            result+=bfs(num)
            break
        if i * i == num:
            result += 1
            break
        i += 1
    return result


if __name__ == '__main__':
    print("%d的完全平方数个数为%d"%(23,Wanquan(23)))