[虚拟机OA]Team Formation 2 团队构成

 

FC Codelona is trying to assemble a team from a roster of available players. They have a minimum number of players they want to sign and each player needs to have a skill rating within a certain range. Given a list of players‘ skill levels with desired upper and lower bounds,determine how many teams can be created from the list.

 

For example,the list includes players with skill levels [12,4,6,13,5,10]. They want to hire at least 3 players with skill revels between 4 and 10,inclusive.
Four of the players meet the criteria,giving them a selection set of {4,10}.

 

Teams Could be the following:
{4,6},{4,10},{5,10} and {4,10}.
There are 5 ways to satisfy the criteria.

 

Function Description
Complete the function countTeams in the editor below. The function must return the total number of teams that can to formed per the criteria.

 

CountTeams has the following parameters:
Skills[skills[0],... skills[n-1]]:  an array of integers that represent the skill level per player
k: the minimum number of team members required
t: the lower limit for skill level,inclusive
r: the upper limit for skill level inclusive

 

题意:

 

思路:

 

代码

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...