題目

解答

1
2
3
4
5
6
7
8
9
10
11
12
s = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 
121, 144, 169, 196, 225, 256, 289, 324,
361, 400, 441, 484, 529, 576,625, 676,
729, 784, 841, 900, 961]
for i in range(int(input())):
n = int(input())
m = int(input())
x = 0
for j in s:
if n<=j<=m:
x += j
print('Case',str(i+1)+':',x)