This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
using namespace std;
int main()
{
int i,j;
int a,b;
long long ans=0;
scanf("%d%d",&a,&b);
int k;
int s,l;
if((b-a+1)%2==0) {
k=(b-a+1)/2;
if(a%2==0) {
s=a;
l=b-1;
} else {
s=a+1;
l=b;
}
} else {
if(a%2==0) {
k=(b-a+1)/2+1;
s=a;
l=b;
} else {
k=(b-a+1)/2;
s=a+1;
l=b-1;
}
}
ans=(s+l)*k/2;
if(a<3) ans-=2;
printf("%lld",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |