← All problemsSign in

Math, math everywhere

Arun was given a binary string s = s0s1....sm-1 and an integer N = p1^a1p2^a2....pn^an. He is supposed to find the number of integers k, 0 ≤ k < N, such that for all i = 0, 1, ..., m - 1 gcd(k + i, N) = 1 iff si = 1 He is unable to solve this problem and needs you to solve it for him. Print the answer modulo 10^9 + 7. ###Input: In the first line of input there is a string s consisting of 0's

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