제출 #2853

#제출 시각아이디문제언어결과실행 시간메모리
2853naver1다각형 (GA5_polygon)C++98
0 / 100
0 ms1088 KiB
#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;
    printf("%lld",ans);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...