Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

### Akhilanand0011's blog

By Akhilanand0011, history, 16 months ago,

• +1

 » 11 months ago, # |   0 Can someone help with the approach, please? Thanks!
 » 7 weeks ago, # |   -7 The problem asks to count number of possible (x, y, z) such that Ax + By + Cz = P, where x, y, z >= 0. Also notice that C/gcd(A, B, C) ≥ 200. If we iterate over all possible z, the problem simplifies to finding number of solutions for Ax + By = P - Cz, where minX = 0, maxX = (P - Cz) / B, minY = 0, maxY = (P - Cz) / A. This is a linear diophantine equation. You can learn how to solve this here.