Double Squares
https://www.facebook.com/codingcompetitions/hacker-cup/2011/qualification-round/problems/A
Last updated
https://www.facebook.com/codingcompetitions/hacker-cup/2011/qualification-round/problems/A
Last updated
5
10
25
3
0
11
2
0
1
1def count_ways(n):
count = 0
limit = int(n**0.5)
for x in range(limit + 1):
y_square = n - x**2
y = int(y_square**0.5)
if y * y == y_square and x <= y:
count += 1
return count
i = 0
waste = int(input())
try:
while True:
i += 1
print("Case #%d: %d" % (i, count_ways(int(input()))))
except EOFError:
exit()