← All problemsSign in

Three Numbers

You are given 3 numbers N, D and K . Consider all the permutations of number N. Find out the number of permutations that give K modulo D. Input - The input consists of 3 space-separated numbers N , D , K Output - Output the required answer. Constraints - 0 ≤ N ≤ 1014 - 1 ≤ D ≤ 1000 - 0 ≤ K ≤ D - 1 Example Input: 214 2 0 Output: 4 Explanation 214 has 6 permutations. Out of these th

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