Official

A - A*B*C Editorial by evima


There are just \(O(K\log K)\) pairs \((A, B)\) such that \(AB\leq K\) (keyword: harmonic series), and there are \(\left\lfloor \frac{K}{AB}\right\rfloor\) candidates for \(C\) when \(A, B\) are fixed, so we can find the answer as the sum of this value over all candidates of \((A, B)\), in \(O(K\log K)\) time.

We can also find the answer with brute force in \(O(K\log^2 K)\), which is fast enough.

posted:
last update: