# Find the number of possible triangles

An interview question. We are given three positive integers p, q, r such that:

p + q + r = 27
and p<q<r.


Find the number of triangles that are possible using p, q, and r.

HINT: Since $\frac{27}3=9$, it’s clear that $r$ must be at least $10$. In order for $p,q$, and $r$ to be the sides of a non-degenerate triangle, it’s necessary and sufficient that $p+q>r$, so $r$ cannot be more than $13$. Thus, $10\le r\le 13$, and it’s not hard to count the possibilities for each value of $r$.