公式

C - A x B + C 解説 by evima


For each pair \((A,B) \) of positive integers such that \(A \times B \lt N\), a positive integer \(C\) such that \(A \times B + C = N\) is uniquely determined. Therefore, it is sufficient to count the number of such pairs of positive integers \((A,B)\).

When \(A\) is fixed, the number of possible \(B\) is \(\left \lfloor \cfrac{N - 1}{A} \right \rfloor\). Therefore, we could solve the problem by performing exhaustive search on \(A\) from \(1\) to \(N-1\).

Sample code in Python: https://atcoder.jp/contests/abc179/submissions/16844575

投稿日時:
最終更新: