← All problemsSign in

Cool Numbers

CodeChefRating 2713Open on judge ↗

Consider a positive integer N. Denote its decimal digits by X1, X2,..., XK. N is called a Cool Number if you can select at most three (but at least one) of its digits such that the following number is divisible by N: (X1 + X2 + ... + XK – S)S where S is the sum of the selected digits. Let LC(N) be the largest Cool Number which is not greater than N, and UC(N) be the smallest Cool Number which

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start