Given $n, a, b$ are all positive numbers $(1 \le a, b, n \le 10^{18})$. ↵
↵
Count how many numbers from $1$ to $n$ that can be represented as $a\times x + b\times y$ with $x,y \ge 0$ are arbitrarily non-negative integers.↵
↵
I only know a $O(\sqrt{n})$ algorithm.↵
↵
Thanks.
↵
Count how many numbers from $1$ to $n$ that can be represented as $a\times x + b\times y$ with $x,y \ge 0$ are arbitrarily non-negative integers.↵
↵
I only know a $O(\sqrt{n})$ algorithm.↵
↵
Thanks.