Блог пользователя Expose

Автор Expose, история, 3 года назад, По-английски

Recently I have a problem ..How can I count the number of pair who's sum lies between a given range a and b in a vector?? Suppose I have vector is 5 1 2 and the a =4 and b =6 output will be 2 cause 5+1=6 and 1+2 =3 but 5+2=7 which is not be included..So the output should be 2 ,How to solve it in a optimal way?

Теги sum
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится