Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum=596873;
- nums = open('input.txt').map { |line| line.to_i }.sort_by {|i| (i < sum/2) ? sum - i : i};
- i = 0;
- while i < nums.length - 1 do
- if nums[i] + nums[i+1] == sum
- p "yes";
- exit 0;
- end
- i += 1;
- end
- p "no"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement