Official

C - A x B + C Editorial by evima


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

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

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

posted:
last update:



2025-04-08 (Tue)
13:41:10 +00:00