Lab 0 (optional (8/27/2014) - Please do not go to the lab)

You need not go to your lab. Please think and try to do this problem. 
Suppose you are given a set, S, of numbers {i,j,k,...}, and a number x, write
an algorithm to find whther there is a set of three distinct numbers in the set S which add up to the given number  x. 
example: {1,2,4,10,23,11, 18,-9,-17} and x= 3 and the answer will be
2,18,-17

Input: S and x
Output: Distinct Numbers that add up to x or no such numbers exist.

What is the time complexity of your algorithm. A psuedo code will suffice.
Extra problem: (here numbers need not be distinct and we are allowed to have any number (not just three)) 17th August 2014 challenge from American puzzle maker Sam Lloyd: You have a target with six rings, bearing the numbers 16, 17, 23, 24, 39, and 40. How can you score exactly 100 points, by shooting at the target. (This is similar to the dart game - you are allowed to throw as many darts as possible) Source Problem