Advertisement
Guest User

Untitled

a guest
Jun 18th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.23 KB | None | 0 0
  1. sum=596873;
  2. nums = open('input.txt').map { |line| line.to_i }.sort_by {|i| (i < sum/2) ? sum - i : i};
  3.  
  4. i = 0;
  5. while i < nums.length - 1  do
  6.   if nums[i] + nums[i+1] == sum
  7.     p "yes";
  8.     exit 0;
  9.   end
  10.   i += 1;
  11. end
  12.  
  13. p "no"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement