Pair Sum

Правка en1, от Expose, 2023-10-11 18:02:45

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Expose 2023-10-11 18:02:45 322 Initial revision (published)