제출 #2782

#제출 시각아이디문제언어결과실행 시간메모리
2782mhkim4886다각형 (GA5_polygon)C++98
100 / 100
0 ms1088 KiB
#include <stdio.h>

int main()
{
    long long a, b;
    scanf("%ld %ld", &a, &b);

    if(a < 3 && b < 3)
    {
        printf("0");
        return 0;
    }
    if(a < 3) a = 3;
    if(b < 3) b = 3;
    if(a % 2 == 1) a++;
    if(b % 2 == 1) b--;

    long long answer;
    if(((b - a) / 2 + 1) % 2 == 0) answer = (a + b) * ((b-a)/2+1) / 2;
    else answer = a + (a+2 + b) * (b-a) / 4;

    printf("%ld", answer);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...