Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In preparation for a sports tournament, you have n training exercises available. Completing the i - th exercise improves your skills by arr [ i
In preparation for a sports tournament, you have n training exercises available. Completing the ith exercise improves your skills by arri points. You can only perform one exercise per day, and once you complete an exercise, you must wait k days before repeating it For example, if k and you perform exercise on day you cannot repeat it on days and but can do it again on day
Given two targets: achieve at least c skill points within d days. Determine the maximum k that allows you to meet this goal. If no such k exists or k is arbitrarily large, output
Examples:
Input:
Output:
Explanation:
In the given example, one way to gain skill point over days with K is as follows:
Day : do exercise and gain skill points.
Day : do exercise and gain skill points.
Day : do nothing.
Day : do exercise and gain skill points.
In total, we gained skill points.
InputOutput
execution time limit seconds cpp
memory limit GB
input integer n
Number of exercises
Guaranteed constraints:
n
input integer c
Amount of skill points you have to gain atleast within d days
Guaranteed constraints:
c
input integer d
Number of days
Guaranteed constraints:
d
input array.integer arr
Represent skill points you gained on completing ith exercise
Guaranteed constraints:
arri
output integer
The maximum k that allows you to gain atleast c skill point within d days, if not possible or k is arbitrary large then return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started