# Handsome Number Editorial

Can anyone provide the Editorial for https://www.codechef.com/NCL2017/problems/NCL1706

Here is the Decription of how I solved this problem using diophantine equation for 3 variables.
let’s countofFive be Number of 5’s that will be in answer,CountOfTwo be Number of 2’s that will be in answer and CountOfThree be Number of 3’s that will be in answer.Now CountOfThree must be divisible by 10,CountOfTwo must be divisible by 15,CountOfFive must be divisible by 6.So I came up with diophantine equation…
6CountOfFive+15CountOfTwo+10*CountOfThree=n
Now solve for CountOfThree,CountOfTwo,CountOfFive.Now first print 6 multipled byCountOfFive times no.5,10 Multiplied by CountOfThree times no.3,15 multiplie by CountOfTwo times number 2.This Will be required answer to the problem.Hope You get this.

4 Likes

Can anyone provide some good links that explain how to solve linear diophantine equations ?

@pankajkhan Here are some usefull questions and learning source of linear diophantine equation.

Learning source:-

Questions:-

2 Likes