The Weekly Challenge - 113, TASK #1: Represent Integer

You are given a positive integer $N and a digit $D.

Write a script to check if $N can be represented as a sum of positive integers [all] having $D at least once [in their decimal representation]. If check passes print 1 otherwise 0.

NOTE

There is a Haskell version of this script in the file 113-1-represent_integer_haskell.hs.

There is a blog post about this.