시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB293847637.624%

문제

상근이는 제1사분면에 아래와 같은 패턴을 그리고 있다.

직사각형이 주어졌을 때, 직사각형에 포함되는 어두운 정사각형의 수를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 직사각형의 왼쪽 아래 꼭짓점 좌표(X1, Y1)와 오른쪽 위 좌표(X2, Y2)가 주어진다. (0  ≤ X1 < X2 ≤ 1,000,000, 0 ≤ Y1 < Y2 ≤ 1,000,000)

출력

입력으로 주어진 직사각형에 포함된 어두운 정사각형의 수를 출력한다.

예제 입력 1

2 3 7 6

예제 출력 1

8

예제 입력 2

0 4 2 104

예제 출력 2

100

예제 입력 3

4 1 7 50

예제 출력 3

72
W3sicHJvYmxlbV9pZCI6IjMxNjQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzMjhcdWQxMzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWM4MWMxXHVjMGFjXHViZDg0XHViYTc0XHVjNWQwIFx1YzU0NFx1Yjc5OFx1YzY0MCBcdWFjMTlcdWM3NDAgXHVkMzI4XHVkMTM0XHVjNzQ0IFx1YWRmOFx1YjlhY1x1YWNlMCBcdWM3ODhcdWIyZTQuPFwvcD5cclxuXHJcbjxwIHN0eWxlPVwidGV4dC1hbGlnbjogY2VudGVyO1wiPjxpbWcgYWx0PVwiXCIgc3JjPVwiaHR0cHM6XC9cL3VwbG9hZC5hY21pY3BjLm5ldFwvMzk0NmQyODUtYWViNy00MTg4LTg3MDEtN2YyNTMyZmNjMzdiXC8tXC9wcmV2aWV3XC9cIiBzdHlsZT1cIndpZHRoOiAyNzNweDsgaGVpZ2h0OiAyNzJweDtcIiBcLz48XC9wPlxyXG5cclxuPHA+XHVjOWMxXHVjMGFjXHVhYzAxXHVkNjE1XHVjNzc0IFx1YzhmY1x1YzViNFx1Yzg0Y1x1Yzc0NCBcdWI1NGMsIF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lOyAxIDAwMCAwMDAsIDAgJmxlOyBZMSAmbHQ7IFkyICZsZTsgMSAwMDAgMDAwLjxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPlRoZSBmaXJzdCBhbmQgb25seSBsaW5lIG9mIG91dHB1dCBzaG91bGQgY29udGFpbiBhIHNpbmdsZSBpbnRlZ2VyICZuZGFzaDsgdGhlIHRvdGFsIG51bWJlciBvZiBkYXJrIHNxdWFyZXMgaW5zaWRlIHRoZSBnaXZlbiByZWN0YW5nbGUuPFwvcD5cclxuXHJcbjxwPk5vdGU6IHVzZSB0aGUgNjQtYml0IHNpZ25lZCBpbnRlZ2VyIHR5cGUgKGludDY0IGluIFBhc2NhbCwgbG9uZyBsb25nIGluIENcL0MrKykuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCJ9XQ==

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2006 > National Competition #1 - Seniors 1번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: jwvg0425