eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Everyone out of the Pool

Everyone out of the Pool

When you rent a table at a pool hall, the proprietor gives you a \textbf{4}-by-\textbf{4} tray of \textbf{16} balls, as shown in Figure (a) below. One of these balls, called the "cue ball", is white, and the remaining \textbf{15} are numbered \textbf{1} through \textbf{15}. At the beginning of a game, the numbered balls are racked up in a triangle (without the cue ball), as shown in Figure (b). \includegraphics{https://static.e-olymp.com/content/b8/b860d70af4870f8a67c31f633b8b93f8849a8c10.jpg} Now imagine other pool-like games where you have a cue ball and x numbered balls. You'd like to be able to rack up the \textbf{x} numbered balls in a triangle, and have all \textbf{x+1} balls perfectly ll a square \textbf{m}-by-\textbf{m} tray. For what values of \textbf{x} is this possible? In this problem you'll be given an lower bound \textbf{a} and upper bound \textbf{b}, and asked how many numbers within this range have the above property. \InputFile Input for each test case will one line containin two integers \textbf{a} \textbf{b}, where \textbf{0} < \textbf{a} < \textbf{b} ≤ \textbf{10^9}. The line \textbf{0 0} will follow the last test case. \OutputFile For each test case one line of output as follows: \textbf{Case n: k} if there are \textbf{k} integers \textbf{x} such that \textbf{a} < \textbf{x + 1} < \textbf{b}, \textbf{x} balls can be racked up in a triangle, and \textbf{x + 1} balls ll a square tray.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
15 17
14 16
1 20
0 0
Выходные данные #1
Case 1: 1
Case 2: 0
Case 3: 2
Источник 2011 East Central Regional Contest