F. Sub-array Problem
Practice
3.1 (9 votes)
Problem
29% Success 1082 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

 Given an Array \(A\) of $$N$$ integers.You have to find number of subarrays having $$Primicity$$ less than or equal to $$K$$.

$$Primicity$$ of sub-array is defined an number of primes in that subarray.

Input:

First line contains \(N\) and \(K\).

Second line contains \(N\) integers.

Output:

Print the Number of sub-arrays having $$Primicity$$ \(\leq\)$$K$$.

Constraints:

\(1\leq N,K\leq 10^5\)

\(1\leq A[i]\leq 10^7\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
25 votes
Tags:
AlgorithmsBinary SearchBit manipulationEasySearchingTwo pointer
Points:20
17 votes
Tags:
AlgorithmsBinary SearchEasySearching
Points:20
272 votes
Tags:
Binary SearchEasyOpenSorting
Editorial

No editorial available for this problem.