#P15523. [ROIR 2015 Day 1] hall 选择大厅
[ROIR 2015 Day 1] hall 选择大厅
Problem Description
To hold the opening ceremony of the Informatics Olympiad, the organizers need to choose a suitable hall. The hall must be rectangular, and the length of each side must be a positive integer.
To fit all participants in the hall and also avoid making the hall look too empty, the area should be between and square meters (including and ).
To put up posters on the hall walls to show students' results in the contest, and at the same time avoid making people feel there are too few results, the perimeter of the hall should be between and meters (including and ).
Before making the final choice, the organizers plan to check every hall that meets the size requirements. A hall of size is considered the same as a hall of size . To understand the amount of work needed to review the halls, the organizers ask: how many different halls satisfy the above constraints.
Task: Write a program that, given , , , and , computes the number of distinct hall sizes that satisfy the requirements.
Input Format
The input file contains four integers separated by spaces: , , , and (, ).
Output Format
The output file should contain one integer — the number of halls that satisfy the conditions.
2 10 4 8
3
Hint
Explanation of the Example
In this example, the hall sizes that satisfy the constraints are: , , .
Grading System and Subtask Description
Subtask 1 (50 points)
$1 \leq A \leq B \leq 1000, 4 \leq C \leq D \leq 1000$.
You get points only if all tests pass.
Subtask 2 (50 points)
$1 \leq A \leq B \leq 10^9, 4 \leq C \leq D \leq 10^9$.
This subtask has tests, and each test is worth points. Each test is scored independently.
Translation source: GPT 5.2.
Translated by ChatGPT 5