Submission #2856

# Submission time Handle Problem Language Result Execution time Memory
2856 2013-07-31T23:34:17 Z naver1 다각형 (GA5_polygon) C++
0 / 100
0 ms 1088 KB
#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
1 Incorrect 0 ms 1088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -