Advertisement
brewersfan1976

count_sum_of_two_representations_3.rb

Mar 6th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.25 KB | None | 0 0
  1. def countSumOfTwoRepresentations3(n, l, r)
  2.     result = 0
  3.     i = 1
  4.    
  5.     while (i <= n - i)
  6.           if (l <= i and n - i <= r)
  7.              result = result + 1
  8.           end
  9.        
  10.           i = i + 1
  11.     end
  12.    
  13.     return result
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement