시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 237 60 54 33.333%

문제

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

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

입력

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

출력

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

예제 입력 1

2 3 7 6

예제 출력 1

8
W3sicHJvYmxlbV9pZCI6IjMxNjQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzMjhcdWQxMzQiLCJkZXNjcmlwdGlvbiI6IjxwPlx1YzBjMVx1YWRmY1x1Yzc3NFx1YjI5NCBcdWM1NDRcdWI3OThcdWM2NDAgXHVhYzE5XHVjNzQwIFx1YzgxYzFcdWMwYWNcdWJkODRcdWJhNzRcdWM1ZDAgXHVjNTQ0XHViNzk4XHVjNjQwIFx1YWMxOVx1Yzc0MCBcdWQzMjhcdWQxMzRcdWM3NDQgXHVhZGY4XHViOWFjXHVhY2UwIFx1Yzc4OFx1YjJlNC48XC9wPlxyXG5cclxuPHA+PGltZyBhbHQ9XCJcIiBzcmM9XCJcL3VwbG9hZFwvaW1hZ2VzXC9wYXR0ZXJuLnBuZ1wiIHN0eWxlPVwiaGVpZ2h0OjI3OXB4OyB3aWR0aDoyOTRweFwiIFwvPjxcL3A+XHJcblxyXG48cD5cdWM5YzFcdWMwYWNcdWFjMDFcdWQ2MTVcdWM3NzQgXHVjOGZjXHVjNWI0XHVjODRjXHVjNzQ0IFx1YjU0YywgXHVjOWMxXHVjMGFjXHVhYzAxXHVkNjE1XHVjNWQwIFx1ZDNlY1x1ZDU2OFx1YjQxOFx1YjI5NCBcdWM1YjRcdWI0NTBcdWM2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msgc3F1YXJlcyBpbnNpZGUgdGhlIGdpdmVuIHJlY3RhbmdsZS48XC9wPlxyXG5cclxuPHA+Tm90ZTogdXNlIHRoZSA2NC1iaXQgc2lnbmVkIGludGVnZXIgdHlwZSAoaW50NjQgaW4gUGFzY2FsLCBsb25nIGxvbmcgaW4gQ1wvQysrKS4mbmJzcDs8XC9wPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwicHJvYmxlbV9sYW5nX2NvZGUiOiJcdWM2MDFcdWM1YjQifV0=

출처

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

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