ABC179 C A x B + C
$ Aを固定して考える. すると$ (N - 1) / Aの切り捨てだけ$ (B, C)の組が出てくる.
実装例: https://atcoder.jp/contests/abc179/submissions/19200371