Perfect Subarrays
You are given an array A, which consists of N integers. Also, you have an integer K. Let's call a subarray A[L..R] perfect, if the average of the numbers AL, AL + 1, ..., AR - 1, AR is greater than or equal to K. I.e. the average of the numbers {2, 5, 9, -3} equals to 3.25. So, your task is quite simple: you are to count the number of perfect subarrays of A. Input The first line con
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.
Sign in to chat with the tutor and save your progress.
Sign in to start