Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
If there are
dupvotes,
upvotes, and
downvotes, then this problem is asking for how many ordered triplets of
satisfy the following system of equations:

where
and
could be any two of
,
, and
.
No need to do anything fancy for the first problem. Just brute force all possibilities of upvotes, downvotes, and dupvotes and see how many of them add to the net points and satisfy the ratio. Don't be fooled! Although there are three unknowns, the solution is not
. You only need to brute force
and
. Since
is given,
is already solved as
. Another thing to note is that the statement mentioned that all three values will be positive, so we need not worry about infinite ratios.
Real numbers are icky, and reducing the ratios is just too much work. To check if two ratios
and
are equal, we can simply cross multiply and see if
equals
.
Comments