이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |