Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code in C with comments: We have to create the regionals team - this year, it turns out there's no limit to how many students
Code in C with comments:
We have to create the regionals team - this year, it turns out there's no limit to how many students can participate, since the contest will be held over Zoom. So we want to create a team with the maximum number of students. But you also know that a team should be balanced. It means that the programming skill of each pair of students in a created team should differ by no more than 5, our lucky number. Your task is to report the maximum possible number of students in a balanced team. Input The first line of the input contains one integer n (1sns2-105) the number of students. The second line of the input contains n integers a1,a2.,an (1sas10), where a; is the programming skill of the i-th student. Output Print one integer - the maximum possible number of students in a balanced team. Examples
Step by Step Solution
★★★★★
3.31 Rating (139 Votes )
There are 3 Steps involved in it
Step: 1
include include Note prev always contains max team size calculated and intially 0 int balancedTeam...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