Akhilanand0011's blog

By Akhilanand0011, history, 16 months ago, In English
 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

»
11 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone help with the approach, please? Thanks!

»
7 weeks ago, # |
  Vote: I like it -7 Vote: I do not like it

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.