Submission #2857

# Submission time Handle Problem Language Result Execution time Memory
2857 2013-07-31T23:42:23 Z naver1 다각형 (GA5_polygon) C++
60 / 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 && b>1) ans-=2;
    printf("%lld",ans);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
# 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 -