#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long long a, b, test, i, t, sum;
scanf("%lld", &test);
for(t=1; t<=test; t++)
{
scanf("%lld%lld", &a, &b);
sum=0;
for(i=a; i<=b; i++)
{
if(i%2 !=0)
{
sum=sum+i;
}
}
printf("Case %lld: %lld\n", t, sum);
}
return 0;
}
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
long long a, b, test, i, t, sum;
scanf("%lld", &test);
for(t=1; t<=test; t++)
{
scanf("%lld%lld", &a, &b);
sum=0;
for(i=a; i<=b; i++)
{
if(i%2 !=0)
{
sum=sum+i;
}
}
printf("Case %lld: %lld\n", t, sum);
}
return 0;
}
No comments:
Post a Comment