Partitioning
Practice
2.7 (14 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
81% Success 1872 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given a binary string of length N(containing only 0's and 1's) and two integers C,P.
Put exactly 3 dividers in the string so that the integer between first and second divider (its decimal equivalent) is C and that between second and third divider is P(its decimal equivalent). There cannot be more than 25 digits in binary representation of P or C(inclusive of preceeding or leading 0's). Find the number of ways to put these dividers.
CONSTRAINTS:
\(1 \le N \le 10^6\)
\(1 \le C,P < 2^{25}\)
INPUT:
The first line contains a string of binary numbers.
The next line contains 2 space-seperated integers C and P
OUTPUT:
In a single line, print the number of ways in which the 3 dividers can be put.
Submissions
Please login to view your submissions
Similar Problems
Points:20
72 votes
Tags:
EasyMath
Points:20
16 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
26 votes
Tags:
AlgorithmsEasy
Editorial