eolymp
bolt
Try our new interface for solving problems
Problems

Line and squares

Line and squares

In a rectangular Cartesian coordinate system defined by two straight line belonging to her points (\textbf{0}, \textit{\textbf{W}}) and (\textbf{100}\textit{\textbf{N}}, \textit{\textbf{E}}). Also raised \textit{\textbf{N}}\textbf{^2} squares with sides parallel to coordinate axes. Square of \textit{\textbf{S_i}}_\{,j\} is the coordinate angles (\textbf{100}\textit{\textbf{i}}, \textbf{100}\textit{\textbf{j}}) and (\textbf{100}\textit{\textbf{i}} - \textbf{100}, \textbf{100}\textit{\textbf{j}} - \textbf{100}), \textit{\textbf{i}}, \textit{\textbf{j}} = \textbf{1}, \textbf{2}, ..., \textit{\textbf{N}}. Required to find the number of squares having a common point with the line. Прослушать На латинице \subsubsection{Словарь - \href{http://www.google.com.ua/dictionary?source=translation&hl=ru&q=%D0%A1%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B5&langpair=ru%7Cen}{Открыть словарную статью}}\begin{enumerate} \item существительное \begin{enumerate} \item message \item communication \item report \item announcement \item information \item news \item notice \item notification \item statement \item service \item account \item word \item advice \item item \item disclosure \item announcing \item intimation \item transaction \item conveyance \item intelligence \item commerce \item piece of information \end{enumerate} \end{enumerate} \InputFile The first line contains three integers, \textit{\textbf{N}}, \textit{\textbf{W}} and \textit{\textbf{E}}, separated by spaces. \textbf{1} ≤ \textit{\textbf{N}} ≤ \textbf{100}, \textbf{0} ≤ \textit{\textbf{W}}, \textit{\textbf{E}} ≤ \textbf{100}\textit{\textbf{N}}, all numbers are integers. \OutputFile Output a single number - the number of squares.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3 150 50
Output example #1
4