pruge
시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2006 National Competition #1 - SeniorsBOJ 3164
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.
문제
A pattern composed of dark stripes (as depicted in the figure below) spans the entire first quadrant in the rectangular coordinate system.
[이미지 1]
Write a program that finds the total number of dark squares inside the given rectangle.
입력
The first and only line of input contains four integers X1, Y1, X2, Y2 – the coordinates of the rectangle with the lower left corner in (X1,Y1) and upper right corner in (X2,Y2).
0 ≤ X1 < X2 ≤ 1 000 000, 0 ≤ Y1 < Y2 ≤ 1 000 000.
출력
The first and only line of output should contain a single integer – the total number of dark squares inside the given rectangle.
Note: use the 64-bit signed integer type (int64 in Pascal, long long in C/C++).
예제
예제 1
입력
2 3 7 6
출력
8
예제 2
입력
0 4 2 104
출력
100
예제 3
입력
4 1 7 50
출력
72
코드를 제출하려면 로그인하세요.