#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
int length;
int i,j;
int temp[100];
int num1,num2,sum;
while(scanf("%d",&length)!=EOF)
{
for(i=0;i<length*2;i++)
scanf("%d",&temp[i]);
for(i=0;i<length*2;i+=2)
{
num1 = (int)ceil(sqrt(temp[i]));
num2 = (int)floor(sqrt(temp[i+1]));
sum = 0;
for(j=num1;j<=num2;j++)
sum += (j*j);
printf("Case %d: %d\n",(i/2)+1,sum);
}
}
return 0;
}
沒有留言:
張貼留言