Briefing
The difficulty of a Code Golf question can be calculated as such:
$$\text{clamp} \left( \left\lceil \left( \frac v a \div 700 \right) \times 10 \right\rceil, 0, 10 \right)$$
Where \$v\$ is the number of views a question has
and \$a\$ is the number of answers a question has
and \$⌈x⌉\$ is the ceiling operator.
Also:
$$\text{clamp}(x, min, max) = \begin{cases} min & x < min \\ x & min \le x \le max \\ max & max < x \end{cases}$$
This question's current difficulty: ***
Task
Write a program that will take two integers (v and a)
and output the difficulty in asterisks (*)
.
The input can be in the form of an array, a separated string or as separate function arguments
Test Data
Views Answers Difficulty Program Output
163 2 2 **
548 22 1 *
1452 24 1 *
1713 37 1 *
4162 32 2 **
3067 15 3 ***
22421 19 10 **********
Example with pseudocode
v: 1713
a: 37
out = clamp(ceil(((v/a)/700)*10), 0, 10); // evaluates to 1
//program will output '*'
The shortest code in bytes wins! Trailing/ leading spaces are allowed.
/700 * 10
instead of/70
? \$\endgroup\$